通过 HTTPS 从 Eclipse 推送到我的 GitHub 存储库停止工作:“不允许 git-receive-pack"错误 [英] Pushing from Eclipse to my GitHub repository via HTTPS stopped working: "git-receive-pack not permitted" error

查看:54
本文介绍了通过 HTTPS 从 Eclipse 推送到我的 GitHub 存储库停止工作:“不允许 git-receive-pack"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几周前,我最近推送了我的 GitHub 存储库.我从 GitHub 得到一个主要消息,GitHub 即将退出常规授权,并准备用另一种授权方式替换它.

所以今天我向我的 GitHub 存储库推送了一个新更新并收到了消息:

git-receive-pack 不允许

这就引出了两个问题:

  1. EGit 现在停止工作了吗?
  2. 我有 Eclipse 2021-03,我该如何解决这个问题以便推送?

解决方案

  1. 转到您的GitHub 帐户,进入设置>开发者设置 >个人访问令牌 网站:

    1. 点击右上角的生成新令牌按钮
      • 输入注释,例如GitHub 回购令牌
      • 选择到期,例如无过期
      • 勾选复选框repo
    2. 点击底部的生成令牌按钮
    3. 复制生成的令牌到剪贴板

  2. 在 Eclipse 中,在 Git 存储库 视图中:

    1. 右键点击Remotes GitHub 子节点(origin 或您在克隆存储库时选择的名称)并选择配置推送...
    2. 点击更改...按钮以更改右上角的 URI
    3. 将密码替换为 使用复制的生成的 GitHub 令牌
    4. 点击完成保存以应用更改

SSH

  1. 创建一个 SSH 密钥(如果你已经有了,请跳过这一步):

    1. 在 Eclipse 中,在 preferences General >网络连接 >SSH2 标签密钥管理点击生成 RSA 密钥...按钮
    2. 点击保存私钥...并选择一个位置,最好是您的用户主目录的子文件夹 .ssh

  2. 将公钥上传到您的 GitHub 帐户:

    1. 对于新创建的密钥,密钥管理标签中显示的字符串复制到剪贴板;对于现有密钥,将其添加到首选项 General >网络连接 >SSH2选项卡General并复制公钥文件.pub
    2. 的内容
    3. 转至您的GitHub 帐户设置,进入SSH 和 GPG密钥 部分,然后点击新的 SSH 密钥 按钮
    4. 粘贴复制的公钥到Key字段

  3. 将已克隆存储库的 HTTPS 更改为 SSH URL:

    1. 在 Eclipse 中,在 Git 存储库 视图中右键单击存储库并选择 属性 并单击打开按钮
    2. config 文件的文本编辑器中,按如下方式更改远程 URL:

      HTTPS(旧;不适用于 push 不再):

      url = https://github.com/;/<repo>.git


      SSH(新):

      url = git@github.com:/.git

另见:

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?

解决方案

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)

  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:

这篇关于通过 HTTPS 从 Eclipse 推送到我的 GitHub 存储库停止工作:“不允许 git-receive-pack"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆