2014-03-28 64 views
0

我在我的bitbucket帳戶上有一個私有存儲庫。今天,我想要 添加一臺新電腦,以訪問其中一個私人存儲庫。克隆git存儲庫權限被拒絕

所以,我做了以下內容:

ssh-keygen 
Generating public/private rsa key pair. 
Enter file in which to save the key (/d/.ssh/id_rsa): 
Created directory '/d/.ssh'. 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /d/.ssh/id_rsa. 
Your public key has been saved in /d/.ssh/id_rsa.pub. 

後,我複製從id_rsa.pub鑰匙,把它添加到我的我的到位桶倉庫 SSH密鑰列表。

但是...當我現在想克隆我的倉庫,我得到以下錯誤:

Permssion denied (publickey) 
fatal: Could not read from remote repository 

問題出在哪裏?

+0

您確定您嘗試以創建密鑰的用戶身份訪問存儲庫嗎? –

+0

是的,我確信 – user1882812

+0

@ÖzgürEroğlu通過SSH訪問BitBucket,用戶總是'git',因此@ user1882812正在訪問存儲庫的本地用戶無關緊要 – LoicAG

回答

0

確保您使用的(在你的情況id_rsa)生成的私鑰從到位桶中進行克隆時:

git -i /path/to/your/private/key clone [email protected]/owner/project.git 


編輯
一個更永久的,便捷的解決方案是省略-i /path/to/your/private/key部分位於上述命令中,而是在SSH配置文件中包含以下內容:

Host bitbucket.org 
    IdentityFile /path/to/your/private/key 
相關問題