简体   繁体   中英

Permission denied on git clone of my own private repo on a remote server - even though I added a new public key and all

I have been setting up an instance of a server (Amazon EC2, Ubuntu 12.x), and have got stuck trying to clone my own private repo from git.

I've been looking at https://help.github.com/articles/generating-ssh-keys and https://help.github.com/articles/error-permission-denied-publickey for a while, but still no good.

I have generated a new ssh key pair on the remote machine with

ssh-keygen -t rsa -C "myemailaddress@myemail.com"

and set up my git config fine, and I have added the public key to my github account . The email address is the same as the one I use on my local machine's ssh key (I don't know if that matters).

After starting an ssh-agent and then doing ssh-add -l , I get a fingerprint result that matches what is said in my github public key. ssh -T git@github.com also tells me that I have successfully authenticated.

However, whenever I try

git clone https://github.com/dmonopoly/myprivateproject.git

or

git clone git@github.com:dmonopoly/myprivateproject.git

on the remote machine (which I have sshed into), I get this error:

fatal: could not create work tree dir 'myprivateproject'.: Permission denied

Ideas? I've handled the permission denied (public key) before, but this seems different. Help appreciated.

 fatal: could not create work tree dir 'myprivateproject'.: Permission denied ^^^^^^^^^^^^^^^^^^^^ 

That has nothing at all to do with access to the repository. You are trying to clone it to a directory where you don't have write access. Check permissions on the machine running git clone .

sudo in front of the command took care of it for me. Easier than tracing the folder needing a permission change.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM