Pushing from Eclipse to my GitHub repository via HTTPS stopped working: "git-receive-pack not permitted" error
Solution 1:
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
- Enter a Note, e.g.
- Click the Generate token button at the bottom
- Copy the generated token to the clipboard
- Click the Generate new token button in the upper right
- 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
-
Right-click the Remotes sub-node for GitHub (
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
- 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
-
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>.git
SSH (new):url = git@github.com:<username>/<repo>.git
See also:
- Video tutorial Import repository from Github to Eclipse using SSH
- EGit User Guide
Solution 2:
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