egit - not authorized - eclipse

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...

Update 2022: In what follows, always use:
a App password, not your account password (see blog post).
So create your app password.
a BitBucket Cloud, since BitBucket server will be discontinued in Feb. 2024.
A. To specify credentials individually for each remote
Open Git repositories view,
open "Remotes > origin > <your push url>"
click "Change Credentials..."
(From User Guide - Resource Context Menu)
B. To specify credentials per server
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.
Create a text file called .netrc (_netrc in Windows) in the user home directory.
Add content to the file in this form:
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.

You can try:
eclipse/myeclipse > menu
window > preferences > general > security >
content > click "delete" > ok

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.
Go to your GitHub.com settings, and in the left hand pane click Personal access tokens.
Click Generate new token. Select the scopes that you'd like this token to be able to use, and generate it.
Copy the token. It should look something like this: 9731f5cf519e9abb53e6ba9f5134075438944888 (don't worry, this is invalid).
Back in Eclipse (Juno, since that's OP's version), click Window > Show View > Other.... Under Git, select Git Repositories.
A new pane appears, from which you can open (repository name) > Remotes > origin.
Right click on a node and choose Change Credentials.... Enter your username for User, and your secure access token for the Password.

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.
Click Eclipse -> Preferences on menu.
Expect a popup window called Preferences.
Expand the "General" tree item.
Double click the "Security" tree item.
Expect the main pane of the popup to change to "See 'Secure Storage' for..."
Click 'Secure Storage'.
Expect the main pane to change to tabbed window.
Click the "Contents" tab.
Click "Delete".
Accept a warning that all your secure information is deleted.
Click "Cancel" or "Apply" to exit the popup window.
Click the 'Git Pull' icon and expect to be prompted for username and password.

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.

Bitbucket Cloud recently stopped supporting account passwords for Git authentication. From march 2022.
So use app password. Please read more information on below links.
Bitbuckect Announcement
Bitbuckect blog
App password

Related

Getting Can't connect to any URI (not authorized) error while pushing the commit to github repo [duplicate]

I recently did a push to my GitHub repository for a few weeks ago. I got a main from GitHub that GitHub is soon quitting regular authorization and going to replace it with another authorization method.
So today I push a new update to my GitHub repository and got the message:
git-receive-pack not permitted
That's leads to two questions:
Has EGit stopped working now?
I have Eclipse 2021-03, how can I fix this issue so I can do a push?
Since August 13, 2021, GitHub does not support authentication via HTTPS with your GitHub account password for security reasons anymore. Instead, in Eclipse, when pushing to a GitHub repository or when fetching from a private repository, you will get a git-upload-pack not permitted on 'https://github.com...' error.
As solution, use either
a GitHub specific Personal access tokens as password instead of your previously used GitHub account password or
SSH with an SSH key of which the private and public key is on your local machine and configured in Eclipse and the public key is uploaded to your GitHub account instead.
Personal access token (GitHub specific)
Go to your GitHub account to Settings > Developer settings > Personal access tokens website:
Click the Generate new token button in the upper right
Enter a Note, e.g. GitHub repo token
Choose Expiration, e.g. No expiration
Tick the checkbox repo
Click the Generate token button at the bottom
Copy the generated token to the clipboard
In Eclipse, in the Git Repositories view:
Right-click the Remotes sub-node for GitHub (origin or the name you have chosen when you have cloned the repository) and choose Configure Push...
Click the Change... button to change the URI in the upper right
Replace the password with with the copied generated GitHub token
Click Finish and Save to apply the changes
SSH
Create an SSH key (skip this step when you already have one):
In Eclipse, in the preferences General > Network Connections > SSH2 tab Key Management hit the Generate RSA Key... button
Hit Save Private Key... and choose a location, preferably the subfolder .ssh of your user home directory
Upload public key to your GitHub account:
For a new created key, copy the string shown in the Key Management tab to the clipboard; for an existing key add it in the preferences General > Network Connections > SSH2 tab General and copy the content of the public key file <name>.pub
Go to your GitHub account settings to the SSH and GPG keys section and hit the New SSH key button
Paste the copied public key into the Key field
Change HTTPS to SSH URLs of already cloned repositories:
In Eclipse, in the Git Repositories view right-click the repository and choose Properties and click the Open button
In the text editor of the config file change the remote URL as follows:HTTPS (old; does not work for push anymore):url = https://github.com/<username>/<repo>.gitSSH (new):url = git#github.com:<username>/<repo>.git
See also:
Video tutorial Import repository from Github to Eclipse using SSH
EGit User Guide
GitHub has disabled the HTTPS protocol
Most certainly not.
I push using HTTPS to GitHub without any issue, but I now have to use, as password, a PAT (Personal Access Token) instead of the GitHub user account password.
Make sure to create a new token, which will follow the new token format (March 2021)
ghp_ for Personal Access Tokens
I was using eclipse and git with ssh and had an issue with it using the wrong key.
When searching for the error: "Cannot log in at github.com:22"
It sent me to this answer: Cannot log in GitHub into Eclipse which ended up leading me to this one.
For anyone else that stumbles across this you need to navigate to
Window -> Preferences
Then from there expand
General -> Network Connections -> SSH2
Then in the right pane select the "General" tab and click the Add Private Key.. button and select the private key used for git. If you used a password for your key (which you should) then you should be prompted to enter it.
After this I could push and pull again no issues.
You need to create an app password or token to import the project from git/bitbucket. This token you need to use as a password.
Here create a token by giving the necessary permissions according to your requirements and create it.

Eclipse Photon - Unable to clone - Transport Exception - not authorized [duplicate]

I recently did a push to my GitHub repository for a few weeks ago. I got a main from GitHub that GitHub is soon quitting regular authorization and going to replace it with another authorization method.
So today I push a new update to my GitHub repository and got the message:
git-receive-pack not permitted
That's leads to two questions:
Has EGit stopped working now?
I have Eclipse 2021-03, how can I fix this issue so I can do a push?
Since August 13, 2021, GitHub does not support authentication via HTTPS with your GitHub account password for security reasons anymore. Instead, in Eclipse, when pushing to a GitHub repository or when fetching from a private repository, you will get a git-upload-pack not permitted on 'https://github.com...' error.
As solution, use either
a GitHub specific Personal access tokens as password instead of your previously used GitHub account password or
SSH with an SSH key of which the private and public key is on your local machine and configured in Eclipse and the public key is uploaded to your GitHub account instead.
Personal access token (GitHub specific)
Go to your GitHub account to Settings > Developer settings > Personal access tokens website:
Click the Generate new token button in the upper right
Enter a Note, e.g. GitHub repo token
Choose Expiration, e.g. No expiration
Tick the checkbox repo
Click the Generate token button at the bottom
Copy the generated token to the clipboard
In Eclipse, in the Git Repositories view:
Right-click the Remotes sub-node for GitHub (origin or the name you have chosen when you have cloned the repository) and choose Configure Push...
Click the Change... button to change the URI in the upper right
Replace the password with with the copied generated GitHub token
Click Finish and Save to apply the changes
SSH
Create an SSH key (skip this step when you already have one):
In Eclipse, in the preferences General > Network Connections > SSH2 tab Key Management hit the Generate RSA Key... button
Hit Save Private Key... and choose a location, preferably the subfolder .ssh of your user home directory
Upload public key to your GitHub account:
For a new created key, copy the string shown in the Key Management tab to the clipboard; for an existing key add it in the preferences General > Network Connections > SSH2 tab General and copy the content of the public key file <name>.pub
Go to your GitHub account settings to the SSH and GPG keys section and hit the New SSH key button
Paste the copied public key into the Key field
Change HTTPS to SSH URLs of already cloned repositories:
In Eclipse, in the Git Repositories view right-click the repository and choose Properties and click the Open button
In the text editor of the config file change the remote URL as follows:HTTPS (old; does not work for push anymore):url = https://github.com/<username>/<repo>.gitSSH (new):url = git#github.com:<username>/<repo>.git
See also:
Video tutorial Import repository from Github to Eclipse using SSH
EGit User Guide
GitHub has disabled the HTTPS protocol
Most certainly not.
I push using HTTPS to GitHub without any issue, but I now have to use, as password, a PAT (Personal Access Token) instead of the GitHub user account password.
Make sure to create a new token, which will follow the new token format (March 2021)
ghp_ for Personal Access Tokens
I was using eclipse and git with ssh and had an issue with it using the wrong key.
When searching for the error: "Cannot log in at github.com:22"
It sent me to this answer: Cannot log in GitHub into Eclipse which ended up leading me to this one.
For anyone else that stumbles across this you need to navigate to
Window -> Preferences
Then from there expand
General -> Network Connections -> SSH2
Then in the right pane select the "General" tab and click the Add Private Key.. button and select the private key used for git. If you used a password for your key (which you should) then you should be prompted to enter it.
After this I could push and pull again no issues.
You need to create an app password or token to import the project from git/bitbucket. This token you need to use as a password.
Here create a token by giving the necessary permissions according to your requirements and create it.

Netbeans JGit github password authentication deprecated,. how to reset?

I am using netbeans 8.2 to push to github but now get messages saying
You recently used a password to access the repository at XXX with git using JGit/3.6.2.201501210735-r.
Basic authentication using a password to Git is deprecated and will soon no longer work. Visit > https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more > information around suggested workarounds and removal dates.
Thanks,
The GitHub Team
How can I reset my authentication to enter a github token (https://github.com/settings/tokens) instead of my password?
I've just faced with it.
Just generate token and use inplace of password.
See also https://issues.apache.org/jira/browse/NETBEANS-5252
To reset the password, I followed the instructions at Change Git remote password used by NetBeans, and entered my new github token to the password field. Copied from that answer:
Right click your project and go to Git -> Remote -> Push... Select 'Specify Git Repository Location', update your password, click Next. It may give you error again. Close the popup and try pushing again. You should be able to push now.
For my new token, since I only want to pull and push to the project, I used the default repo options.

IntelliJ cannot log in to GitHub

For some reason, a new IntelliJ installation is unable to log in to GitHub. (The credentials are correct.)
It happens both when I try to "share project on githu" and "checkout project from version control", select Git and then try to log in to GitHub.
Here's the login prompt:
Server: github.com
Login: <my username>
Password: <my password>
And the error message:
Invalid authentication data. Can't create token:
scopes - [repo, gist] - not IntelliJ Plugin_1 422
Unprocessable Entity - Validation Failed
[OauthAccess; description]already_exists: null
Now, this is on a freshly installed Windows 10 computer, with a freshly installed IntelliJ. So there are no old tokens or anything like that anywhere in the system. This is the first attempt to access GitHub from IntelliJ. Logging in via web works fine.
That kind of error messages can be frustrating, as it takes more than a little knowledge on the subject to understand exactly what is wrong. Usually, however, the problem is either the authentication (invalid username/email/password) or that there's a problem with git (locally).
First of all, check that you have git installed by running "git" from the command prompt. This is a more common mistake than one would think.
Second, try y.bedrov's suggestion. Log in to github.com on the web. Settings -> Developer settings -> Personal access tokens. Create a new token and then, in IntelliJ, select Enter Token at the login prompt.
Tokens are considered a more secure way to authenticate, I believe.
Oh, in case you generated the token from GitHub and are unable to use that in IntelliJ...
Then, go to Settings -> Version Control -> GitHub
In the Login to GitHub popup, click "Use Token" on the top right corner of the popup.
Add your token and enjoy.
When you make first attempt to access GitHub from IntelliJ, you do not have intellij-github authorization in place and also tokens.
So, follow the instructions here to get rid to this issue.
https://www.jetbrains.com/help/idea/github.html#register-account
After this, the project can be easliy shared on github.
In my situation it was because I was behind a proxy and IntelliJ was not able to reach the internet.
To verify whether IntelliJ is able to reach the internet go to Settings>System Settings>HTTP Proxy
Click on check connection and try for example http://google.nl.
I had to set my proxy to Auto-detect so it will use the proxy of Windows.
From my experience, you will have to set the remote of this project, try to find the "Remote..." within the "VCS" tab, then when you set it, IntelliJ will open your default browser and there is a permission check, which is what lead to your error message.
In short, Set remote, Authorize IntelliJ on GitHub Settings.
The issue is that IDE tries to create a token with the name that already exists. Appears to be related with the token name case - see https://youtrack.jetbrains.com/issue/IDEA-198120
As a workaround, navigate to https://github.com/settings/tokens and delete all tokens called IntelliJ Plugin (including those with suffix)
Couple of issues can be there to block you from accessing your github repo and throwing 403 error. Hence please go step by step.
Step-1 : Local git is corrupted or not working
git branch -r [If it gives result you are good]
git ls-remote --heads <remot_git_location>
if one of the above is working then your local git is good. If not use
git config --global --unset credential.helper
Step-2 : From your IDE (IntelliJ or PHPStorm etc) see git is configured and test it.
Go to Default Settings-->GitHub and Your host should be "https://github.com"
Get your Github personal token. Login to your github account from browser. Settings -> Developer settings -> Personal access tokens.
o Select all “repo”, gist and “read.org” in your scope.
o Create the token
Last step: If still not working, Go to VCS--> GIT --> Remotes --> Change the repo to include token explicitly
https://user_name:<your_TOKEN>#github.com/reponame.git
Paste the token in your IDE and test the connection.
If your problem still persists then check if there is network issue.
I have had the same problem to sign up from Android Studio's interface to my GitHub account. At the end what worked is installing Git from VSC tab as this guy said:
https://stackoverflow.com/a/65059893/14715236
But i still not being able to access my account (note: with Login-Password method) so generating token it worked.
I also had the problem with logging to github using Intelij IDE. It shown "invalid authentication data" msg with 404 error. Installing the latest version of the IDE solve that problem.
If you use two factor auth then you need to use an access token.
If you use HTTPs access, after 2-factor authentication is enabled you will need to configure an Access token (BitBucket calls it app password) and use it to authenticate.
https://intellij-support.jetbrains.com/hc/en-us/articles/206537004-How-to-access-GIT-remote-repositories-with-2-factor-authentication
Github has disabled password based auth to api as here https://docs.github.com/en/rest/overview/other-authentication-methods
In my case somehow I was logged out and IDE was showing this error repeatedly instead of login prompt.
So, I just logged in again in setting-> Version Control -> github.
There I saw I was logged out.
After logging in, error was gone and prompt for
Access token was shown when I clicked on git->github on top menu of IDE.
Hope my answer helps you saving some time
Since August 13, 2021. GitHub no longer supports password authentication for git operations. You must generate a token in your GitHub account. Follow
"Settings> Developer Setting > Personal access tokens > tokens (classic)". while generating your token, you must "SET PERMISSION" for your token. Whenever you want to Sign In via Intellij or git terminal, you must enter your username and your token (instead of password) in the password textbox.

Possible to Connect Netbeans with GitHub?

I know the Git integration is Netbeans 7.0 is new and under development, but has anyone had success on pushing/pulling to GitHub?
When I click Git->Push the remote repository url shows up correctly under Step 1. Configured Repository.
But is just stays stuck on " Connecting to repository". It also pops up a box saying "Specify Git repository location" with the exact same url , clicking OK does nothing.
If instead I choose "Specify Git Repository Location" I eventually get an error, "Cannot connect to the remote repository at git#github.com:username/..."
ps. I am aware of the other similar stack questions but they are confusing, one person mentions that he was able to do this, while others mention is not yet possible to use a remote Git connection.
I have had the same issue.
And now it works fine for me.
I have done this:
1 With CLI ( Terminal for me) Define your remote repo :
cd yourlocalfolder
git remote add origin git#github.com:username/repo.git
2 Open Netbeans (7.1 for me)
Go to Team > Git > Remote > Push
3 You should see your remote repo preselected
4 in Private /public key browse to your rsa file
usr/username/ssh/id_rsa
5 Click on Next
6 Done
You need check 'Specify Git Repository Location:'
'Repository URL:' https://github.com/<your username>/<yourGitFile>.git
'User:' <your username>
But is just stays stuck on " Connecting to repository". It also pops up a box saying "Specify Git repository location" with the exact same url , clicking OK does nothing.
I faced the exact same issue and after I did some research I found that the problem was with the password.
GitHub isn’t accepting passwords for Git operations anymore.
So instead of using a password, Github suggests using Personal Access Token.
Go to your Github account settings.
Go to Developer settings in the sidebar.
Go to Personal access tokens.
Generate new token.
Make sure to check repo scope checkbox to access your repositories.
After you get your access token you can copy it and past it in the password field in the "Specify Git repository location" window and try to push your project.