I have been using Github for a little while and I have been fine with git add
, 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 .git/config
are:
[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 = ############
This question is related to
git
authentication
github
I'm not really sure what I did to get this error, but doing:
git remote set-url origin https://...
didn't work for me. However:
git remote set-url origin [email protected]:user/repo
somehow worked.
I was adding to Bitbucket linked with Git and had to remove the stored keys, as this was causing the fatal error.
To resolve, I opened the command prompt and ran
rundll32.exe keymgr.dll, KRShowKeyMgr
I removed the key that was responsible for signing in and next time I pushed the files to the repo, I was prompted for credentials and entered the correct ones, resulting in a successful push.
This the way, I resolved my access denied problem in GIT GUI and git bash.
This SSH key is copy-pasted in the GitHub access token.
For me everything was fine, I also tried the Windows Credentials Manager but then also the problem was not resolved. Then suddenly, I got pop up from the firewall, which was the main culprit behind all. After I clicked on allow manually then I could fetch or push to GitHub.
Hi, I was getting the same error i tried all the solutions whichever mentioned in this page, but didn't work. Finally, i found the solution, So thought of posting it. Please correct me if i am wrong anywhere. These kinds of error comes if sometimes your system password has changed recently anytime. It will try to validate from old password. So, Follow these steps:
click on Remove from vault
Try the following steps to Edit or Remove the saved credentials:
Windows Credentials Manager
shortcut and double-click it to open the application. Windows Credentials
tab. Problem Statement: "git fatal authentication failed". I am using bitbucket.
Solution: I simply deleted the user from using access management of bitbucket and then added the same user. The .gitconfig file is simple
[user]
name = BlaBla
email = [email protected]
[push]
default = simple
Just to chime in here, what fixed the issue for me was I simply canceled out of the initial prompt, the ssh one opened up with my bitbucket account, I entered the password there and everything worked as expected.
Make sure that your ssh key is added to your current ssh session.
Copy the output of cat ~/.ssh/id_rsa.pub
to your GitHub settings under SSH and GPG keys.
Update your current ssh session with ssh-add ~/.ssh/id_rsa.pub
I am using Windows Powershell with Openssh installed.
I think that for some reason GitHub is expecting the URL to NOT have subdomain www. When I use (for example)
git remote set-url origin https://www.github.com/name/repo.git
it gives the following messages:
remote: Anonymous access to name/repo.git denied
fatal: Authentication failed for https://www.github.com/name/repo.git
However, if I use
git remote set-url origin https://github.com/name/repo.git
it works perfectly fine. Doesn't make too much sense to me... but I guess remember not to put www in the remote URL for GitHub repositories.
Also notice the clone URLs provided on the GitHub repository webpage doesn't include the www.
I had the same problem. I set url in that way:
git remote set-url origin https://github.com/zkirkland/Random-Python-Tests.git
I also removed from config file this entry: askpass = /bin/echo
.
Then "git push" asked me for username and password and this time it worked.
If you have enabled the two-factor authentication on your Github account, then sign in to your GitHub account and go to: https://github.com/settings/tokens/new to generate new access token, copy that token and paste as a password for authentication in terminal.
This happened to us after forcing "Two Factor Authentication" before login from Gitlab. We had to paste the text inside id_rsa.pub to Gitlab, and then reintroduce the repository in VS code using the terminal.
Just from your .config file change:
url = http://www.github.com/###user###/Random-Python-Tests
To:
url = http://###user###@github.com/###user###/Random-Python-Tests
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:
For me, I forgot that I had changed the password on Github.com, and my keychain for shell authentication never updated to that new password. Deleting everything git from my keychain and then re-running the git request helped solve the issue, prompting me again for the new password.
In case this is tangentially helpful, since this question is now a top hit for http authentication problems with git: Windows Credential Manager had stored my password correctly, and since I was using Git LFS I configured an http URL instead of the usual ssh://.
My problem was that my corporate password policy forced an account password change but I never updated my stored credentials (since I always use an ssh key).
Simply updating the password directly in the Wincred GUI worked: just look for a git:https://<your-url>
entry.
May you have changed password recently for you git account
You could try the git push
with -u
option
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
This worked for me, and it also remembers my credentials:
Run gitbash
Point to the repo directory
Run git config --global credential.helper wincred
In my case, I recently changed my windows password and I have SSH key configured for git related actions (pull, push, fetch etc.,), after I encountered the "fatal: Authentication failed" error, I updated my password in the windows credential manager (Control Panel\User Accounts\Credential Manager)for all items starting with git:..., and tried again, worked this time!
in Android studio canary build 3.1+, if you are using Android studio git tool, than you can use following :
If connection is successful , than you are done and you can use android studio github UI client.
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.
Make sure you have WRITE permission to push.
read ***write*** admin
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.
I also ran into the error (that's why I am landed here), but none of the suggestions worked for me. This was my very first time I try to deploy local Git to azure. When I got this error, I reset my credentials (by clicking the link in Azure) after a few tries. The problem is that at this point it tells me my user name is already taken, so I also changed my user name to another one. In the end, I manually deleted the .git folder on my local drive, and redeployed it without problem.
with correct credentials if the problem prevails
if your using androidstudio 2.1 beta then its bug , upgrade to beta 2 (3 mb update file) , this worked for me
If you are using ssh and cloned with https this will not work. Clone with ssh and then push and pulls should work as expected!
I tried the token verification method and got it to work ~3 times and wasted around 2 hours of time for that. For some reason it does not work very well for our company.
My solution was to change the authentication method from HTTPS to SSH. Here is a Github guide (https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent).
After you have created the SSH key, remember to change the SSH address origin:
git remote add origin [email protected]:user/repo.git
If you are on windows and trying to push to a windows server which has domain users working as repository users (TFS), try getting into TFS URL (i.e. http:\\tfs
) with IE. enter your domain account credentials and let the page appear.
CAUTION only use INTERNET EXPLORER! other browsers wont change your system credentials.
Now go to git bash and change your remote user for the repository like below :
git config user.name "domainName\userName"
And done, now you can push!
I've ran into "$ git fetch fatal: Authentication failed for 'http://...." after my windows password has expired and was changed. Multiple fetches, reboot and even reinstall of git with windows credential manager didn't help.
Surprisingly the right answer somewhere here in comments but not in answers (and some of them are really weird!). You need to go to Control panel -> Credential Manager / Windows Credentials and update you password for git:http://yourrepoaddress
I was facing the same issue on windows. Most of the time I normally face the issue due to using multiple git accounts. If you are on windows, please do open the terminal as an administrator and try running the commands again. Make sure that you have the administrator access rights.
Before you try everything above, try to git push
again, yes it works on me.
Source: Stackoverflow.com