dmonopoly
dmonopoly

Reputation: 3331

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 "[email protected]"

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 [email protected] also tells me that I have successfully authenticated.

However, whenever I try

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

or

git clone [email protected]: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.

Upvotes: 8

Views: 10925

Answers (2)

lschofield
lschofield

Reputation: 21

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

Upvotes: 0

Jan Hudec
Jan Hudec

Reputation: 76286

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.

Upvotes: 13

Related Questions