2015-10-18 80 views
-1

我使用Bitbucket,並且正在嘗試爲新部署設置新的EC2 AMI(Amazon Linux)。我正在使用部署密鑰測試從Bitbucket的git repo中下載源代碼。當我運行...ssh -Tv驗證並列出正確的git回購,但我無法克隆

ssh -Tv [email protected] 

...它具有更長的版本響應以下,但要點是,它驗證...

authenticated via a deploy key. 
You can use git or hg to connect to Bitbucket. Shell access is disabled. 
This deploy key has read access to the following repositories: 
myacct/myrepo: deploy-key -- deploy-key 

但後來當我運行.. 。

sudo git clone [email protected]:myacct/myrepo.git 

...我得到的迴應...

Cloning into 'myrepo'... 
Permission denied (publickey). 
fatal: Could not read from remote repository. 
Please make sure you have the correct access rights and the repository exists. 

我不明白我在做什麼錯,有什麼提示?


編輯: 我要補充,我得在~/.ssh/config的定義如下:

Host bitbucket.org 
IdentityFile ~/.ssh/deployment.pem 
StrictHostKeyChecking no 

而且deployment.pem確實是我的,我用來生成私鑰部署密鑰(公共),存儲在Bitbucket中。

回答

0

該死的,就像不是使用sudo時調用git clone...命令。不知道爲什麼sudo會阻止它運行,但肯定是去除它像一個魅力工作。