Issues Running 'git clone' from the Terminal

I'm running SouceTree (Version from Windows 7 Professional 64-bit SP1.  I'm attempting to clone from GitLab.

I've been having some issues getting the 'git clone' command to work from the terminal.  Whenever I attempt to achieve this, I'm met with the following error:

>>>  Cloning into 'C:_Git'...

>>>  Permission denied (publickey).
>>>  fatal: Could not read from remote repository.

>>>  Please make sure you have the correct access rights
>>>  and the repository exists.

However, when I attempt the clone from the UI, using the same URL and destination path, it works fine.  The only thing I can think of is maybe my private or SSH key needs to be located in a certain location on my machine for the get clone command to work from the terminal.  Does anyone have any suggestions or ideas on why this won't work from the terminal?  Thanks ahead of time!


1 answer

0 vote

Hi Rick, 

I'm not familiar with GitLab, but based into your error, looks like you are trying to clone a repo using a wrong SSH Key (or you don't have one). Make sure you have setup the correct key. The following commands will help you:

ssh-add -l #This will list the keys you have loaded

ssh-add ~/.ssh/id_rsa #Should load the correct ssh key from your user 



Renato Rudnicki

Hey Renato, First off, thank you for your response! I would agree with you about using the wrong SSH Key if it weren't for the key working whenever I clone the repository using the UI. It works fine from the UI, but fails from the terminal. I'm assuming the terminal isn't looking in the same place as the UI is though. I do have my authentication agent running, so I'm not sure why the terminal can't find it, but the UI can. user@USER-PC /c/Program Files (x86)/Atlassian/SourceTree $ ssh-add -l Could not open a connection to your authentication agent. user@USER-PC /c/Program Files (x86)/Atlassian/SourceTree $ ssh-add ~/.ssh/id_rsa Could not open a connection to your authentication agent. Currently, I have the keys (private and SSH) sitting on my desktop. I guess I need to figure out how to point the terminal at those keys? Whenever I navigate the terminal to the desktop and attempt the commands again, I receive the same response I listed above.

Hi Ricky, Yes, looks your terminal is not finding the keys (maybe you've downloaded in another place?). Try this: ssh-add /path-to-your-ssh-key/ Then your ssh-key should be loaded (use the same path key you have setup on sourcetree. Also, we have this documentation that can be useful for you. Cheers, Renato

Hey Renato, I gave you suggestion a try, but I still continue to get the open connection error I mentioned: $ ssh-add C:\Users\user\Desktop\repositoryKeys\rickyByrdSSH Could not open a connection to your authentication agent. It's weird because I do have Pageant running. It detects if from the UI so I'm not sure why it's not detecting it from the terminal :-\.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

790 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you