Reputation: 13220
I created a repository on GitLab and I have a local project.
From: git remote -v
I get:
origin [email protected]:projects/MyPrj.git (fetch)
origin [email protected]:projects/MyPrj.git (push)
When I try to push it to the repository with:
git push origin master
I get this error:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I can access the repository with a web browser, but not from git from the command line.
What am I doing wrong?
Upvotes: 0
Views: 4849
Reputation: 1328602
Check what is your remote URL associated with your local cloned repo:
cd /path/to/your/repo
git remote -v
Depending on its scheme (https or ssh), you will need to make sure your authentication is correctly set.
git config credential.helper
returns)/path/to/home/.ssh/id_rsa(.pub)
files (public and private rsa SSH keys, with the public key content registered on your remote hosting service.If this is SSH (on Linux), you need to follow "GitLab and SSH keys " and generate a new set of SSH keys with:
ssh-keygen -P "" -s -t rsa
Then copy the ~/.ssh/id_rsa.pub
content on GitLab.
Upvotes: 2