16

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:

  1. Has EGit stopped working now?
  2. I have Eclipse 2021-03, how can I fix this issue so I can do a push?
howlger
  • 31,050
  • 11
  • 59
  • 99
euraad
  • 2,467
  • 5
  • 30
  • 51
  • 1
    GitHub has disabled the HTTPS protocol. Use git://... with a SSH key that is known to Eclipse on your local computer and uploaded to your GitHub account instead. – howlger Aug 15 '21 at 17:21
  • @howlger Thank you. How can I do that in practice? What should I press on? – euraad Aug 15 '21 at 17:50
  • 1
    If you do not have a SSH key, in Eclipse go to the preferences _General > Network Connections > SSH2_ tab _Key Management_ and hit _Generate RSA Key..._. In your GitHub account go to _Account settings > SSH and GPG keys_ and add the public key. Finally, change the repository URL from `https://...` to `git://...`. – howlger Aug 15 '21 at 18:03
  • @howlger Ok. I have generate the RSA key in Eclipse. I put that key into SSH and GPG keys and add a public key. Is it SSH key or GPG key I should press on? – euraad Aug 15 '21 at 18:18
  • This works. https://www.youtube.com/watch?v=p-Bcw_6KIbU&ab_channel=Let%27sCodeFaster Please post an answer if you want. I can accept it. – euraad Aug 15 '21 at 19:12
  • Thanks. Because you mentioned it, a GPG key is to [signed commits](https://wiki.eclipse.org/EGit/New_and_Noteworthy/5.3#GPG-signing_Commits). – howlger Aug 16 '21 at 12:13

4 Answers4

31

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)

enter image description here

  1. Go to your GitHub account to Settings > Developer settings > Personal access tokens website:
    1. 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
    2. Click the Generate token button at the bottom
    3. Copy the generated token to the clipboard
  2. In Eclipse, in the Git Repositories view:
    1. 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...
    2. Click the Change... button to change the URI in the upper right
    3. Replace the password with with the copied generated GitHub token
    4. Click Finish and Save to apply the changes

SSH

  1. Create an SSH key (skip this step when you already have one):
    1. In Eclipse, in the preferences General > Network Connections > SSH2 tab Key Management hit the Generate RSA Key... button
    2. Hit Save Private Key... and choose a location, preferably the subfolder .ssh of your user home directory
  2. Upload public key to your GitHub account:
    1. 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
    2. Go to your GitHub account settings to the SSH and GPG keys section and hit the New SSH key button
    3. Paste the copied public key into the Key field
  3. Change HTTPS to SSH URLs of already cloned repositories:
    1. In Eclipse, in the Git Repositories view right-click the repository and choose Properties and click the Open button
    2. 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>.git

      SSH (new):
      url = git@github.com:<username>/<repo>.git

See also:

howlger
  • 31,050
  • 11
  • 59
  • 99
  • For anyone reading this: of course HTTPS works perfectly well: you don't have to switch to SSH if you don't want to. – VonC Aug 18 '21 at 16:26
  • @VonC I extended my answer on how to switch to a personal GitHub access token in Eclipse. It would be much nicer and more helpful if you told me that earlier instead of adding your own answer that doesn't say how to do this in Eclipse. If I could, I would give you reputation points for that hint, but unfortunately that's not possible with the way gamification is implemented on Stack Overflow. – howlger Aug 19 '21 at 14:09
  • Every new Eclipse install...I visit your answer and it still works! – euraad Jan 19 '22 at 14:07
  • For anyone who is still struggling like I was: Install the newer version of Eclipse and try this again. I kept having issues until I upgraded. – Kt Mack May 30 '22 at 06:56
  • Authentication did not work in my case (Eclipse version 2022-09). I had to enter the PAT as part of the URI: https://:@ – Günter Dec 15 '22 at 17:59
3

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

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

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.

enter image description here

Kyle Coots
  • 2,041
  • 1
  • 18
  • 24
0

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.

create app password

Here create a token by giving the necessary permissions according to your requirements and create it.

Jatin
  • 91
  • 5