0

I asked for help on stackoverflow and I was told it is more than likely a Ubuntu problem and was recommended to ask here.

I'm trying to clone a private git repo to my web folder on Ubuntu. I've created the SSH key pair & added it to my account settings on githubs end.

ssh-add ~/.ssh/id_ed25519

Identity added: /home/ubuntu/.ssh/id_ed25519 (email)

ssh -vT git@github.com

Hi CNRP! You've successfully authenticated, but GitHub does not provide shell access. debug1: channel 0: free: client-session, nchannels 1 Transferred: sent 2148, received 2336 bytes, in 0.2 seconds Bytes per second: sent 10468.5, received 11384.7

I've tried the following and all respond with similar errors.

git clone git@github.com:CNRP/project-name.git

fatal: could not create work tree dir 'project-name': Permission denied

sudo git clone git@github.com:CNRP/project-name.git

> git@github.com: Permission denied (publickey). fatal: Could not read
> from remote repository.
> 
> Please make sure you have the correct access rights and the repository
> exists.

git clone https://-token-@github.com/CNRP/project-name.git

> fatal: could not create work tree dir 'project-name': Permission
> denied

The folder I'm trying to clone to is the /var/www/ web folder. I'm thinking its possibly something todo with user permissions? I've troubleshooted all the github authentication steps and repeated it multiple times so I'm thinking the SSH authentication isn't the problem.

Any help on what I can do from here to work this out is highly appreciated, Its left me stumped!

CNRP
  • 1
  • When you use sudo, git is presumably looking for SSH keys in root's home directory – steeldriver Feb 12 '23 at 01:00
  • Makes a lot of sense actually! thanks for the help. – CNRP Feb 12 '23 at 01:08
  • Don't use sudo in the first place - fix the permissions of the directory so that your user has the necessary access rights for it. – muru Feb 12 '23 at 03:31
  • Yeah I will be going that route now I know the route of the issue, I was just trying to narrow down what could be wrong initially. – CNRP Feb 12 '23 at 23:11

0 Answers0