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

sql - VB.NET Operand type clash: date is incompatible with int error -

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

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -