Skip to content
Advertisement

sudo -H -u git gitosis-init < ~/id_rsa.pub | error: no such file or directory

I got this shell script from a blog about how to equip git with gitosis. But i got a “No such file or directory” error after running the script.

JavaScript

I am puzzled,as the man manual says that:

JavaScript

,which is cited from linux manual.

The -H option just sets the HOME environment variable to the homedir of the target user as specified in passwd.

However i specified “/home/git” as homedir for git user in my /etc/passwd file.

JavaScript

But why i still got this message? or was incorrect my comprehension of the description in manual?


Append for comments:

And it seems like before with specifying a absolute path.Maybe, it’s not the cause.

JavaScript

Advertisement

Answer

I guess it is because ~ is expanded by bash before transferring to sudo as a argument, why not try to specify a absolute path for you public key file?

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement