Linux Terminal: Fatal error: Authentication failed

Hi there. When I perform a Git push from my integrated VS Code terminal (via command line) there is no problems, but when I try and do the same from my Ubuntu Mate Linux Terminal, it asks for my username and password which is then rejected. A fatal error: “authentication failed error message appears”. I have SHH setup without a username of password. The GitHub username and password that I use is definitely correct because I used it repeatedly to sign into GitHub (even to signup here). I ran the ssh-keygen -o command from my VS Code terminal initially. If this is the reason, can anyone assist me with a system wide Git solution. I do not have to go into VS Code every time I need to do a Git push to GitHub unless I absolutely have to. Any advice will be much appreciated. Kind regards

Two things to check:

  • Use git remote -v in your repository to check if the fetch and pull URLs are correct. For SSH they should start with, not https:.

  • Run ssh -vT to see if SSH authentication works. If it doesn’t work, the verbose log should give some hints what doesn’t work. GitHub does not allow SSH login with passwords.

They’re on https:// in my Linux terminal and in the integrated terminal in VS Code.
When I ran your ssh command there is a “Hi TechnoMageKOMT! You’ve successfully authenticated, but GitHub does not provide shell access.” message.
How do I get my Linux terminal on as well? Should I create another security key? I tried this morning but that did not work.

1 Like

That means your SSH setup works, but the remote repository you’re using on the shell is configured to use HTTPS URLs. You can change the URL for a remote using this command (assuming your remote is using the default name origin):

git remote set-url origin URL

You can find the right URL by going to your repository page, clicking the green “Code” button, and selecting SSH in the popup.

For more on remotes, see: Git - Working with Remotes

Thank you soooo much :smiley: I followed your directions and it now works in both. Your help is really much appreciated.

1 Like