Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission denied when I try to push from local to remote gitlab repository

Tags:

git

gitlab

I have created a repository in gitlab web ui and tried to push my local repository. I added remote repo using the following command:

$ git remote add origin [email protected]:project.git

Then I tried to push but it errors. I don't use ssl. I want to use plain text connection.

$ git push origin master
[email protected]'s password:
Permission denied, please try again.
[email protected]'s password:
Permission denied, please try again.
[email protected]'s password:
Permission denied (publickey,password).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
like image 395
a.toraby Avatar asked Mar 23 '15 19:03

a.toraby


People also ask

How do I push permission to denied GitHub?

This error means the key you are pushing with is attached to another repository as a deploy key, and does not have access to the repository you are trying to push to. To fix this, remove the deploy key from the repository, and add the key to your personal account instead.

Could not read from remote repository in GitLab?

The Git “fatal: Could not read from remote repository” error occurs when there is an issue authenticating with a Git repository. This is common if you have incorrectly set up SSH authentication. To solve this error, make sure your SSH key is in your keychain and you connecting to a repository using the correct URL.


2 Answers

Then I created the test user from web ui. and created the project with the test user.

You would never use that user for contacting a server in ssh: all the authorized keys are grouped under one account, which for gitlab should be git: ~git/.ssh/authorized_keys

See config/gitlab.yml.

So try:

git remote set-url origin [email protected]:project.git
like image 85
VonC Avatar answered Nov 04 '22 22:11

VonC


Newer versions of ssh also disallow DSA key use by default. Make sure you're using RSA keys or make sure your ~/.ssh/config or /etc/ssh/ssh_config files permit DSA keys. You can do this by adding something like this to the appropriate file:

Host your.git.server
    KexAlgorithms +diffie-hellman-group1-sha1
    HostkeyAlgorithms ssh-dss,ssh-rsa

This one bit me.

like image 45
Rick Stevens Avatar answered Nov 04 '22 22:11

Rick Stevens