GIT 已添加 SSH 密钥时推送未授权

GIT push Unauthorized when SSH keys already added

我没有设置任何分支权限,我也已经将 public 密钥添加到 BitBucket SSH 设置中。

┌──[forge@app]──[~/app]                                                                  
└── git status                                                                               
On branch master                                                                             
Your branch is ahead of 'origin/master' by 2 commits.                                        
  (use "git push" to publish your local commits)                                             
nothing to commit, working directory clean                                                   
┌──[forge@app]──[~/app]                                                                  
└── git push origin master                                                                   
Unauthorized                                                                                 
fatal: Could not read from remote repository.                                                

Please make sure you have the correct access rights and the repository exists.                                                                   
┌──[forge@app]──[~/app]                                                                  
└──  

我不断收到

Unauthorized
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

先检查你的current remote URL:

cd ~/app
git remote -v

应该是git@bitbucket.org:<me>/<myproject>

然后检查输出:

ssh -Tv git@bitbucket.org

您将看到您是否已正确验证。