簡體   English   中英

Atlassian Bitbucket - ssh - git 拉動工作,git 推動失敗

[英]Atlassian Bitbucket - ssh - git pull works, git push fails

1. 總結問題

我按照 Bitbucket 的說明設置 ssh。

我有一個 pub/priv 密鑰對,並將 pub 密鑰粘貼到項目的 Bitbucket 設置(訪問密鑰)中。

我在 GCE VM 上有一個構建服務器。 git clone成功, git pull origin master工作。 我正在使用密碼。

但是,如果我在 GCE VM 上git commit單個文件並執行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 master到 bitbucket。

運行ssh-agent /bin/sh然后ssh-add ~/.ssh/id_rsa (替換 id_rsa)用你的私鑰的名字。 你的推動應該有效。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM