Using Su/Sudo When Accessing Remote Git Repositories Over Ssh

proper way to sudo over ssh

Another way is to use the -t switch to ssh:

ssh -t user@server "sudo script"

See man ssh:

 -t      Force pseudo-tty allocation.  This can be used to execute arbi-
trary screen-based programs on a remote machine, which can be
very useful, e.g., when implementing menu services. Multiple -t
options force tty allocation, even if ssh has no local tty.

How do I pull from a git repo on a remote machine through ssh?

From what I understood with your issue, here is my suggestion :
[ Information is somewhat incomplete though ]

GIT reads your id_rsa.pub in root user directory : /home/root/.ssh/id_rsa.pub

That's why your key in /home/your_username/.ssh/id_rsa.pub might not be read by git.

Hence, please check and create the key in /home/root/.ssh/

$ sudo su
$ ssh-keygen
$ cd ~/.ssh
$ cat id_rsa.pub

Hope it helps.

Can I Add Local Users to Manage a Gitolite Repository with SSH?

The gitolite@ on the front of the URL is not actually the user as you use with SSH. It is the service (I assume) on the server so gitolite@localhost:my-repo is completely valid.

You will see a reference to git@ all the time when working with GIT. Your service is gitolite so gitolite@ will always be used.

Git servers authenticate using SSH public keys so the key you created is what allows the user to connect to the server. That key is also related to that user so when that key is used it is assumed that is the user issuing git commands such as a commit.

On a side note a colleague recommend http://documentup.com/skwp/git-workflows-book when I first started using our GIT system and it was a great help in understanding this truly wonderful version control system.



Related Topics



Leave a reply



Submit