linux - make git clone with sudo -


when make git clone ssh user prompt works properly.

git clone ssh://url.com/soft.git soft_git 

the ssh key id_rsa , id_rsa.pub under /home/user/.ssh

my purpose execute git sudo got following error

cloning '/home/user/git/soft'... permission denied (publickey,keyboard-interactive). fatal: not read remote repository.  please make sure have correct access rights , repository exists. 

i create folder /root/.ssh , copy ssh keys got same error

how execute git sudo properly.

when run git using sudo, git run root. because git running root, ssh running root. because ssh running root, trying log on remote server root. remote server not okay (as should be!)

you need 2 things:

  • put username in url: ssh://myusername@url.com/soft.git.

  • make ssh key available root user, because under /root/.ssh instead of /home/user/.ssh. (you point ssh @ correct key, don't know how this, , ssh picky permissions.)


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -