Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git clone works in git shell, but not windows command line

Tags:

git

windows

bower

I have installed Github client tools on my windows machine. If I try to use git from the git shell it works fine. However, if I try to use it from the windows command line, it fails:

c:\git\test>git clone [email protected]:myusername/myrepo.git
Cloning into 'myrepo'...
Permission denied (publickey).
fatal: Could not read from remote repository.

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

I would just use the git shell, but I need the command line set up to work with bower. What else needs to be set up to make git work?

like image 519
Brian Avatar asked Feb 26 '26 09:02

Brian


1 Answers

I was using a windows machine that had no SSH set up on it, so the only SSH key that had been set up was set up by the github installer. In my .ssh directory I had a github_rsa and github_rsa.pub file, but did not have the default ssh keys of id_rsa and id_rsa.pub. The Github clients (both shell & GUI) would use the github_rsa(.pub) key combination when talking to github.com, but git running in the standard windows command line requires the id_rsa(.pub) combination.

To work around this I simply made a copy of the github_rsa private key and gave it the default name of "id_rsa". Similarly I copied the github_rsa.pub key to "id_rsa.pub". Upon doing that, git.exe would work from the windows command line too.

like image 84
Brian Avatar answered Mar 01 '26 00:03

Brian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!