GNU screen 中的 Git 推送失败

标签 git github public-key gnu-screen

我可以很好地从我的 VPS 推送到我的 GitHub 存储库,但是一旦我进入一个 screen ,我的权限就被拒绝了:

littke@[server]:~/src/[repo]$ git push
Pushing to git@github.com:littke/[repo].git
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

即使我能够授权:

littke@[server}:~/src/[repo]$ ssh git@github.com -i ~/.ssh/littke 
Enter passphrase for key '/home/littke/.ssh/littke':
PTY allocation request failed on channel 0
Hi littke! You've successfully authenticated, but GitHub does not provide shell access.

同样,这只发生在 GNU screen 内。我可以把它推到外面。我用谷歌搜索但找不到任何东西。

最佳答案

您在 ssh(-i 选项)中使用的身份文件与 git 使用的身份文件不同。你必须通过你的配置告诉 git 使用哪个身份。参见 github 的 Troubleshooting SSH issues ,“SSH 配置”部分:

Create or open the file at ~/.ssh/config Add the following lines:

Host github.com
  User git
  Hostname github.com
  PreferredAuthentications publickey
  IdentityFile [local path]

关于GNU screen 中的 Git 推送失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5988897/

相关文章:

git - 是否有撤消 git init 的命令?

security - DSA:黑客可以用 *just* 公钥做什么?

Git 发布接收 Hook : update current working branch to staging server

git - 在 github 上将本地 master * 推送到 * gh-pages 分支

linux - 无法在 Linux 上安装 GitHub 操作运行器

Git 获取单个提交

Python RSA加密消息传给其他语言解密

android - PackageInfo.signatures 返回什么?

git - 如何管理 GitHub 上具有未存储在 GitHub 上的外部 git 依赖项的项目

git - 使用 Laravel 的 Envoyer 上传特定的供应商文件