Reputation: 4342
im new to github and im using sourcetree for my git gui, ive been using it for a few days, but now lately im getting an error that says
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/Nosthertus/nodejs_Chat.git/'
also when i tried to make another registration to github returns with error
authorization failed
maybe its because i made a two-factor security, i thought on making a shh-key with github, but does not fix the problem, there has to be a way to make my gui connect to my github account without the login access, how do i fix this?
Upvotes: 17
Views: 53938
Reputation: 6499
If all above is not work, you can try (it works for me)
Upvotes: 0
Reputation: 6893
Settings
.Developer Settings
.Personal access tokens
option.Generate New Token
button/link.This will prompt you to enter your password. After entering your password, you will see a page to add new token.
1. Depending on the requirement, you can set an expiration for your token, or you can set "No expiration" from the dropdown.
2. For scopes, agin, upon your requirement, check-mark the necessary ones.
3. Finally hit `Generate token`.
This will generate a token. Keep a copy of the token.
1. In source tree, from the top-right, select `Settings`.
2. In the pop-up, select remote to add your remote path for repository.
3. Copy the repository path(the .git path) from GitHub into the `URL/ path`, but now you need to add the access-token like following-
if the repository path is https://github.com/username/repository_name.git
, you need to add the access token in-between https://
and github.com/username/repository.git
with @
like-
https://[email protected]/username/repository.git
hit ok and you are good to go now.
Upvotes: 4
Reputation: 1436
To work with GitHub's two-factor authentication in SourceTree you can simply use your access token instead of your password. The steps to do this are as follows:
Upvotes: 11
Reputation: 6232
Make sure that your credentials are OK (please check before in the GitHub website), then, in my case the answer was the following.
1) Delete the "psswd" file without opening Sourcetree:
C:\Users\USER\AppData\Local\Atlassian\SourceTree\passwd
2) After doing that, try to re-enter the application and specify your credentials again.
3) If the previous steps doesn't work, in my case, it was using an incorrect username, so you can edit the "userhosts" file located in the same folder and change to the proper username that you're using:
C:\Users\USER\AppData\Local\Atlassian\SourceTree\userhosts
By doing this, I was able to push again. Hope it helps!
Upvotes: 4
Reputation: 21
I'm using Personal access tokens (GitHub -> settings -> Personal access tokens) and I needed to regenerate the token and then remove the username from SourceTree (SourceTree -> preferences -> network ->remove) then pull and you will be prompt to enter user name and password Use the token you generated
Upvotes: 2
Reputation: 2648
SOURCE TREE
Tools > Options > Authentication > Edit (Edit Password)
Upvotes: 0
Reputation: 14075
If your password recently changed, select the repository, go to Tools --> options, go to Authentication tab and delete the stored password. This will make the system request a new password when you next try to connect.
On OSX: go to SourceTree --> Preferences --> Network and delete the default username there.
Upvotes: 34
Reputation: 1323095
its because i made a two-factor security
Following the Heartbleed bug, GitHub has reset all browser sessions that were active prior to the vulnerability being addressed on our servers.
Check if your PAT (Personnal Access token) is still valid in the Applications section of your GitHub Account.
Note that ssh keys have no effect on an https url like https://github.com/Nosthertus/nodejs_Chat.git
Would you need to use your ssh key, you should at least change the origin url:
git remote set-url origin [email protected]:Nosthertus/nodejs_Chat.git
Upvotes: 5
Reputation: 546
I am using 2FA and I was able to resolve authentication issues by creating an API key as described in the linked document:
Note: after generating the key, copy it and replace your password with the API key in SourceTree (Tools/Options/Authentication tab --> select item in Saved Passwords and click edit...)
I hope this helps.
Upvotes: 2