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

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.

Related

How to push code to a GitHub Repo using Code Sandbox for iOS (2022)

I had trouble (even called support) and they could not answer correctly as to how to push code from CodeSandBox (iOS version) to a GitHub Remote Repo. I keep getting failed to connect (even using SSH and/either regular authentication). (They did lead me down part of the path)
The way that I finally got it to work:
Essentially you have to use SSH (not HTTPS - this will not work!!!! on iOS)
On GitHub
First create your repo on Github (private or public), I selected to create a private one
copy the SSH name address
git#github.com:yourusername/yourprojectname.git
In CodeSandbox,
Add your repo name in the git settings from above
In the SSH Settings, hit the magic wand at the top and let it generate the public and private for you (this was the key....), do not generate a key on your own at your command line (IT WILL NOT WORK)
In the private key passphrase (leave this blank)
Change your branch in the settings to "main" as you GitHub Repo points to
Back in GitHub
Go to your Repo, go to the settings for your repo (not on your account)
Go to Deploy Keys
Add a Deploy Key, paste in the public ssh-rsa key from your code sandbox (that you let it generate), Make sure you check the box "Allow Write Access)
Then you can now commit and push to your remote repository (Took me three days of troubleshooting to figure this out) -:)

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.

egit - not authorized

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

How to link Smartgit to GitHub

I have a public GitHub account for the last year or so. Yesterday I installed SmartGit on my Windows 7 PC. SmartGit works fine locally but I'd like to push to a remote repo on GitHub.
When I look at SmartGit -> Preferences -> Authentication I have selected to use SmartGit as SSH Client. The 'Known Credentials' area is empty.
Under Hosting Providers I have added my github account [username+password] and Clicking on 'Login at GitHub...' it opens the browser and I am logged in successfully.
I would have assumed there would be something populating the Known Credentials area? I tried in vain in see if I had some key-pair stored somewhere that SmartGit could use. Eventually I downloaded PuttyGen and created a pair of keys. I gave them silly names to begin with but after some reading renamed them to *id_rsa* and "id_rsa.pub" and dropped them into my c:\users\MYNAME.ssh directory.
Still no sign of any credentials in SmartGit.
When I run the 'Remote -> Manage Remotes -> Add I enter the git name (based on the link I get from the github repo. I get the "Provide Credentials for authenticating to the SSH Server 'github.com' as user 'git'. The dialog box has pre-populated the Private Key File with the id_rsa I dropped into the .ss directory.
I even went onto github and added this key to the list of SSH keys. Still no joy.
Anyone any suggestions ?
Assuming it works similar on github and bitbucket.
Today I got Smartgit 3.0.10 running with bitbucket by the following steps:
To upload local code
1) Created the repository in bitbucket manually through the website
2) Add your ssh key to the website ( PuttyGen > Conversions > Export OpenSSH )
3) In your local repos check the contents of reposDir.hg\hgrc , should look like
[paths]
default = ssh://hg#bitbucket.org/user123/reposXYZ
if not change it manually. You can also clone your empty repos and the check in the
local copy for this line.
Restart SmartGit and you should be able to push and pull.
If you use the "HTTPS clone URL" on github, it makes a link that requires no SSH keys.
These 2 articles explain it:
https://help.github.com/articles/which-remote-url-should-i-use
https://help.github.com/articles/generating-ssh-keys

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.