首页 > 解决方案 > Atlassian Bitbucket - ssh - git pull 工作,git push 失败

问题描述

1. 总结问题

我按照 Bitbucket 的说明设置 ssh。

我有一个 pub/priv 密钥对,并将 pub 密钥粘贴到项目的 Bitbucket 设置(访问密钥)中。

我在 GCE VM 上有一个构建服务器。 git clone工作成功,并且git pull origin master有效。我正在使用密码。

git commit但是,如果我在 GCE VM 上对单个文件进行小改动,然后执行git push origin master,则会失败并显示以下错误消息。

Enter passphrase for key '/home/proc/.ssh/id_rsa':
Unauthorized
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

git remote -v 节目

origin  git@bitbucket.org:<my-account>/<my-repo>.git (fetch)
origin  git@bitbucket.org:<my-account>/<my-repo>.git (push)

如果git pull origin master工作正常,则 ssh 设置正确。

我添加了以下文件:$HOME/.ssh/.config,内容如下,但没有帮助。

Host bitbucket.org
 IdentityFile ~/.ssh/id_rsa

我的密钥文件是使用以下内容生成的: ssh-keygen -t rsa -b 4096 -C "<comment>"

2. 提供背景,包括您已经尝试过的内容

我有关于 Bitbucket 身份验证问题的所有堆栈溢出文章。

3.显示一些代码

git add <changed file>

git commit -m "made some updates"

git push origin master

4. 描述预期的实际结果,包括任何错误消息

我正在尝试git push origin masterbitbucket。

标签: gitbitbucket

解决方案


推荐阅读