Git push results in "Authentication Failed"
I have been using Github for a little while and I have been fine with
git commit, and
git push so far with no problems. Suddenly I am having an error that says:
fatal: Authentication Failed
In the terminal I cloned a repository, worked on a file and then I used
git add to add the file to the commit log and when I did
git commit, it worked fine. Finally,
git push asks for username and password. I put those in correctly and every time I do this, it says the same error.
Does anyone have any idea what the cause of this problem is and how I can fix it?
The contents of
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = http://www.github.com/######/Random-Python-Tests fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master [user] name = ##### email = ############
If you enabled two-factor authentication in your Github account you won't be able to push via HTTPS using your accounts password. Instead you need to generate a personal access token. This can be done in the application settings of your Github account. Using this token as your password should allow you to push to your remote repository via HTTPS. Use your username as usual.
You may also need to update the origin for your repository if set to https:
git remote -v git remote remove origin git remote add origin [email protected]:user/repo.git
Try the following steps to Edit or Remove the saved credentials:
- Click Start
- Type: Credential Manager (On Windows 10, this is under "Start->Settings". Then search for "Credential Manager")
- See the
Windows Credentials Managershortcut and double-click it to open the application.
- Once the app is open, click on the
- Locate the credentials that you want to remove/update, they will start with "git:" and might begin with "ada:"
- Click on the credential entry, it will open a details view of the entry.
- Click Edit or Remove as required and confirm.
- Wash, rinse, repeat as necessary.
Read more... Read less...
This worked for me, and it also remembers my credentials:
Point to the repo directory
git config --global credential.helper wincred
May you have changed password recently for you git account
You could try the
git push with
git push -u origin branch_name_that_you_want_to_push
After executing above command it will ask for password provide your updated password
Hope it may help you
It happens if you change your login or password of git service account (Git). You need to change it in Windows Credentials Manager too. type "Credential Manager" in Windows Search menu open it.
Windows Credentials Manager->Windows Credential and under Generic Credentials edit your git password.
First, you can make sure to use the proper url:
git remote set-url origin https://github.com/zkirkland/Random-Python-Tests.git
Then, if it was working before, and if it wasn't asking for you username, it must be because you had stored your credentials (login/password) in a
$HOME/.netrc file, as explained here. You can double-check those settings, and make sure that your proxy, if you have one, hasn't changed.
If that still doesn't work, you can switch to an ssh url:
git remote set-url origin [email protected]:zkirkland/Random-Python-Tests.git
But that means you have published your ssh public key in your Account settings.
Basically my credential was expired, and I was facing above issue.
Following 2 command helped me:
git config --global --unset credential.helper git config credential.helper store
It will asks you for credentials next time when you try to push.
Follow below guidelines for more details for secured and unsecured storage of user name and passwords: