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.
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.