holyAsh
holyAsh

Reputation: 343

Phabricator git ssh clone fails with password required error

root@jupiter:/home/jupiter/projects# git clone ssh://[email protected]/diffusion/TD/transcend.git Cloning into 'transcend'...
sudo: sorry, a password is required to run sudo
fatal: Could not read from remote repository.

I have set up the SSHfollowing the manual.

I also have the conduit ping returning the correct message:

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

Below is my visudo file for reference.

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

Upvotes: 3

Views: 3256

Answers (4)

After using the exactly sudoers config described on https://secure.phabricator.com/book/phabricator/article/diffusion_hosting/ I was able to fix the error:

$ vi /etc/sudoers.d/root

root ALL=(root) SETENV: NOPASSWD: ALL

Upvotes: 0

michael.schuett
michael.schuett

Reputation: 4771

I just ran across this and quickly noticed it was due to me not paying attention when setting up the sudoers file. In order to fix this you can run the following commands.

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

Make sure that the paths that are output are the same as the ones you have listed in your sudoers file. No password is required but only when running the binary at those specific locations.

Upvotes: 0

muttonUp
muttonUp

Reputation: 6727

From the same page, but further down https://secure.phabricator.com/book/phabricator/article/diffusion_hosting/#troubleshooting-ssh

You should test these commands on the phabricator server ( I've changed them from the documented ones to fit your environment)

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

If everything works you will receive

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

Also have you made sure to set the phd.user? This would be 'root' in your case

And make sure Defaults requiretty is commented out in your visudo file.

Hope it works for you, as phabricator is an excellent tool.

Upvotes: 2

SerkanC
SerkanC

Reputation: 482

In this answer I've found that you should be careful defining multiple entries for a user in the sudoers file. Your second entry overrides your first entry for the git user, and that first entry does not have a NOPASSWD: directive.

I also had the same problem, and using only the below value in the sudoers file for the git user fixed the problem:

git     ALL=(ALL) NOPASSWD: ALL

This suggests that the git user is trying to use sudo for commands other than just git-upload-pack and git-receive-pack.

It may also be the case that you have more than 1 of these commands in your PATH and the git user finds the commands from another location.

Upvotes: 4

Related Questions