I can clone a project as follows:
$ git clone email@example.com:root/myproject.git ~/bla
But now I wish to clone it to
/var/www. So I try
$ git clone firstname.lastname@example.org:root/myproject.git ~/var/www
But alas, I do not have permission to write to
/var/www. Sudo to the rescue!
$ sudo git clone email@example.com:root/myproject.git ~/var/www Cloning into 'www'... firstname.lastname@example.org's password:
What's this? I am being asked for a password? We shouldn't need no stinking passwords!
I am obviously sending the root user's ssh keys with the request, and as they have not been imported to the git repository, I am being denied. In the past, my solution has been to temporarily change permissions of the folder or first clone it somewhere I have access and then move it using sudo, but would like to learn the right way to do so.
So... How do I use git with my normal user's ssh keys but sudo file permissions?