2013-01-10 41 views
1

我有一個用bitbucket託管的git repo,我在我的主目錄上有一個克隆,我想克隆另一個/var/www目錄。當我嘗試克隆另一個副本到我的www文件夾中我得到這個錯誤在一個以上的位置克隆一個bitbucket git repo

Cloning into 'php'... 
Permission denied (publickey). 
fatal: Could not read from remote repository. 

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

有什麼錯我的公鑰,因爲我可以把改變從克隆的回購我對主文件夾到位桶,我可以看到我對所做的最新提交bitbucket網站。

這種行爲是否存在已知的解釋?

+1

你想克隆爲不同的用戶(www-data或root)嗎?這些用戶不使用您自己的用戶帳戶的私鑰。 – knittl

+0

我在做sudo git clone https://[email protected]/myusername/php.git所以它的根。 – Gandalf

+0

那麼這可能是問題。請注意,您不必重新克隆整個存儲庫,只需將其複製到新位置並設置,然後使用「chown」更改所有者。 – knittl

回答

0

我不認爲你需要將存儲庫克隆到/ var/www中。我認爲最好的解決方案是將存儲庫的符號鏈接創建到/ var/www中。這樣你就不需要同步兩個存儲庫。

但是,如果想要在/ var/www目錄中創建另一個存儲庫,則需要授予用戶編寫目錄的權限或爲root用戶創建一個新的公鑰,並將其複製到bitbucket。