Question

I have a public repository (for my 'dot files') under my personal github username.

I am now using my work computer which is configured for my work account and I'm trying to clone my personal repo which is public.

When I try and clone I get

$ git clone git@github.com:durrantm/setups-and-dotfiles.git
Cloning into 'setups-and-dotfiles'...
Warning: Permanently added the RSA host key for IP address '192.30.252.130' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

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

How can I clone it? I thought the fact it was public would allow it. Is it because my git config has my work account that I don't use at all on github? If so, what's the easier way to fix it? I saw a post about creating a project specific git config but that didn't seem to apply as, catch-22, I can't actually clone the repository in the first place in order to then change it's config! I guess I could rename my global config, change it, do the clone, bring back the old one, but that all seems like a crazy hack and I'd like to avoid that if possible.

Was it helpful?

Solution

Use HTTP instead of SSH to clone:

git clone https://github.com/durrantm/setups-and-dotfiles.git

OTHER TIPS

Could it be a firewall issue? Cloning via SSH requires egress on port 22.

Protocol issue - I was using the one I usually use for private repo.

If I use the one for a public repository then it works and I don't need to switch accounts.
This is what I was looking for.

Syntax:

$ git clone git://github.com/durrantm/setups-and-dotfiles.git

You have two choices: one is to use https or git instead of SSH to clone your repository. Or the other is to create an SSH key on your work machine add your it to your account. SSH access can't work without without a key, for unauthenticated access you need to one of the other protocols.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top