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?
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.
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 git@github.com:Nosthertus/nodejs_Chat.git
我正在使用个人访问令牌(GitHub - >设置 - >个人访问令牌),我需要重新生成令牌,然后从SourceTree中删除用户名(SourceTree - >首选项 - >网络 - >删除)然后拉,你将成为提示输入用户名和密码使用您生成的令牌
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:
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.
SOURCE TREE
Tools > Options > Authentication > Edit (Edit Password)
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!
In addition to setting up the Personal Access Token as Ferie states above, this may be helpful (it's how I finally got it working)
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://access_token@github.com/username/repository.git
hit ok and you are good to go now.
If all above is not work, you can try (it works for me)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.