2014-06-05 63 views
3

根@木星:/家庭/木星/項目#混帳克隆 SSH://[email protected]/diffusion/TD/transcend.git克隆到 '超越'...
sudo:對不起,需要密碼才能運行sudo
致命:無法從遠程存儲庫讀取。Phabricator混帳SSH克隆失敗,需要密碼錯誤

我已經設置了SSH以下manual

我也有管道平安返回正確的信息:

[email protected]:~# echo {} | ssh [email protected] conduit conduit.ping 
{"result":"demo.jupiter.com","error_code":null,"error_info":null} 

下面是引用我visudo命令文件。

Defaults  env_reset 

Defaults  secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 



### User privilege specification 
root ALL=(ALL:ALL) ALL 
git  ALL=(ALL:ALL) ALL 
git ALL=(root) SETENV: NOPASSWD: /usr/local/bin/git-upload-pack, /usr/local/bin/git-receive-pack 

### Members of the admin group may gain root privileges 
%admin ALL=(ALL) ALL 

### Allow members of group sudo to execute any command 
%sudo ALL=(ALL:ALL) ALL 

回答

4

In this answer我發現你應該小心地爲sudoers文件中的用戶定義多個條目。您的第二個條目覆蓋您的第一個條目爲git用戶,並且第一個條目沒有NOPASSWD:指令。

我也有同樣的問題,而僅使用了git的用戶sudoers文件下面的值固定的問題:

git  ALL=(ALL) NOPASSWD: ALL 

這表明git的用戶試圖使用sudo其他命令不僅僅是git-upload-pack和git-receive-pack。

也可能是您的PATH中有超過1個這樣的命令,並且git用戶從另一個位置查找命令。

+0

雖然切換到此*是一種解決方法,但出於安全原因並不理想請仔細檢查您的路徑。如果你使用git,你需要'git','git-upload-pack'和'git-receive-pack'。使用'whereis programname'(即whereis git')查找路徑。我的正確命令是'git ALL =(phabdaemon)SETENV:NOPASSWD:/ usr/bin/git,/ usr/bin/git-upload-pack,/ usr/bin/git-receive-pack。您可以在[官方文檔](https://secure.phabricator.com/book/phabricator/article/diffusion_hosting/#configuring-sudo)中找到需要列入此列表的所有二進制文件的列表, – CodeMouse92

1

從同一個頁面,但進一步下跌https://secure.phabricator.com/book/phabricator/article/diffusion_hosting/#troubleshooting-ssh

應測試phabricator服務器上的這些命令(我從那些文件改變了他們,以適應你的環境)

$ su git 
$ sudo -E -n -u root -- /usr/local/bin/git-upload-pack 

如果一切工作你會收到

usage: git upload-pack [--strict] [--timeout=<n>] <dir>

也有你確信設置phd.user?這將在你的案例中是'根'

並確保Defaults requiretty被註釋掉在你的visudo文件中。

希望它適合你,因爲phabricator是一個很好的工具。

0

我只是碰到了這個,很快就注意到這是由於我在設置sudoers文件時沒有注意。爲了解決這個問題,你可以運行下面的命令。

$ which git-upload-pack 
$ which git-receive-pack 

確保輸出的路徑與您在sudoers文件中列出的路徑相同。不需要密碼,但只有在這些特定位置運行二進制文件時才需要密碼。