Reputation: 3052
I created a new git repo using git init
, and added a git remote:
origin [email protected]:<myname>/<myproject>.git (fetch)
origin [email protected]:<myname>/<myproject>.git (push)
When I try push to my repo using git push -u origin master
, I get the following error:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
However, git push https://gitlab.com/<myname>/<myproject>.git
works. I'm guessing this has to do with SSH keys? I do have a key I generated a year ago for a different project, but I'm not sure what I have to do with it now? Or should I create a new key?
Upvotes: 2
Views: 1539
Reputation: 6084
It is the ssh key which is the issue. You will have to update the remote key storage with your public key, that should fix it.
Upvotes: 1