我試圖在CentOS VPS上從Bitbucket克隆到/ var/www的私人回購。/var/www的適當權限
我在VPS上生成了SSH密鑰對,並將.pub文件作爲(只讀)部署密鑰上傳到Bitbucket。
的關鍵是正確安裝,因爲當我連接使用:
ssh -T [email protected]
正常工作:
authenticated via 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:
<username>/<repo_name>: <Deployment Key Nickname> -- <vps_username>@<vps_hostname>
Connection to bitbucket.org closed.
到目前爲止,一切都很好。但是,當我嘗試克隆一個回購到在/ var/WWW,我得到:
fatal: could not create work tree dir '<repo_name>'.: Permission denied
當我sudo的話,我得到
Permission denied (publickey).
我發現這個便條在Bitbucket docs關於所述錯誤:
You used sudo when attempting the connection You do not need to use sudo when cloning a repository or any other SSH action with Bitbucket.
它看起來像我需要以root權限運行創建樹,但如果我這樣做,它不正確使用SSH密鑰。
因此,我chmod'd/var/www目錄,以便我的非root用戶將有寫權限,並且一切工作正常。但那個目錄現在是777(drwxrwxrwx),可能並不好。
有沒有更好的方法來處理這個問題?我想要/ var/www回到755,但是我不想每當我想更新我的代碼時都臨時使用chmod ...
在此先感謝!