Reputation: 36715
I just connected to GIT from Eclipse Juno using EGit, and successfully cloned a certain remote repository. During the clone I entered my Github username and password, but chose not to save them.
Then I tried to "Fetch from Upstream". I got this error:
https://github.com/biunlp/nlp-lab.git: not authorized
I had no chance of entering my username and password...
This is strange since I connected to this repository in order to clone...
Upvotes: 52
Views: 116768
Reputation: 1951
If you're using Two Factor Authentication on GitHub, the "not authorized" error can be returned even if you are using the correct username and password. This can be resolved by generating a personal access token.
After generating the secure access token, we'll use this instead of a password. Make sure not to leave the page before you're done, because once you leave the page, you'll never see it again (thankfully it can be regenerated, but anything using the previously generated token will cease to authenticate).
This assumes that you've successfully installed EGit and that you've successfully cloned a repository.
Personal access tokens
.Generate new token
. Select the scopes that you'd like this token to be able to use, and generate it.9731f5cf519e9abb53e6ba9f5134075438944888
(don't worry, this is invalid).Window > Show View > Other...
. Under Git
, select Git Repositories
.(repository name) > Remotes > origin
.Change Credentials...
. Enter your username for User
, and your secure access token for the Password
.Upvotes: 35
Reputation: 321
For Eclipse pushes to Azure Devops it worked when used username and PAT (Personal Access Token, not password) as credentials.
Upvotes: 1
Reputation: 1323203
Update 2022: In what follows, always use:
Remotes > origin > <your push url>
"(From User Guide - Resource Context Menu)
If you want to access multiple repositories on the same server without providing the same credentials multiple times, you may use .netrc. With this, eGit will use the configuration you provide.
.netrc
(_netrc
in Windows) in the user home directory.machine my.server1.com login yourUserName password yourPassword machine my.server2.com login yourUserName password yourPassword
The Stash documentation contains more information about .netrc
Security issue The problem with using .netrc
this way is that the password is visible in plain text. Refer to this answer in Stackoverflow to solve that problem.
More secure option (2022): EGit (from issue 441198) can be made (with an extension) to recognize a native Git credential helper, using a secure encrypted cache:
install a native Git
install the GCM (Git Credential Manager), which is cross-platform, and already package with Git For Windows for instance.
instruct EGit to look for credentials in the GCM: gitflow-incremental-builder/gitflow-incremental-builder
register your password or token in said GCM
printf "Host=my.server1.com\nprotocol=https\nusername=yourUsername1\npassword=passwd1" | \
git credential-manager-core store
# and:
printf "Host=my.server1.com\nprotocol=https\nusername=yourUsername1\npassword=passwd1" | \
git credential-manager-core store
Look for executable git-credential-manager-core
, and add its folder to your %PATH%
/$PATH
.
Upvotes: 70
Reputation: 11
Bitbucket Cloud recently stopped supporting account passwords for Git authentication. From march 2022.
So use app password. Please read more information on below links.
Upvotes: 0
Reputation: 21
This worked for me:
Go to Git profile-> Settings -> developer settings-> personal access tokens delete if any existing token and generate a new token [provide note, specify no.of days and repo checked] ->Copy the new token generated Goto eclipse and now when the same login prompt appears, try providing the personal token generated as password instead of Git password.
Upvotes: 1
Reputation: 10063
I had a similar problem when I changed my password on the remote repository.
Here is how I fixed it on Eclipse on Mac:
Important Note: These instructions have the side effect of clearing all passwords and other secure information. I was fine with that, but you will want to consider that before you follow these instructions.
Upvotes: 15
Reputation: 449
You can try:
eclipse/myeclipse > menu
window > preferences > general > security >
content > click "delete" > ok
Upvotes: 44