5

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 test@x.x.x.x: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
test@x.x.x.x's password:
Permission denied, please try again.
test@x.x.x.x's password:
Permission denied, please try again.
test@x.x.x.x'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.
a.toraby
  • 3,232
  • 5
  • 41
  • 73
  • 1
    Is test the account you used to install gitlab? It shoud be, by default, git. – VonC Mar 23 '15 at 19:45
  • I used root to install gitlab. Then I created the test user from web ui. and created the project with the test user. – a.toraby Mar 23 '15 at 19:54

3 Answers3

9

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 git@x.x.x.x:project.git
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks but I don not want ssh. How is that possible without ssh? – a.toraby Mar 23 '15 at 20:05
  • 1
    @a.toraby I understand you don't want to access your repo with an ssh url, but your question has an ssh url, hence my answer. See in the project page if you have an https url for cloning your project repo. – VonC Mar 23 '15 at 20:07
  • Thanks for you reply. I'm I'm a newbie on the gitlab. I took a look at the project page and I found that I'm trying to use a ssh path instead of http. Thanks for your help. – a.toraby Mar 23 '15 at 20:16
  • 1
    @a.toraby no problem: the https one will let use use the actual user (test) instead of the service user (git). – VonC Mar 23 '15 at 20:20
  • Another question: Why should someone prefer ssh to https? – a.toraby Mar 23 '15 at 20:27
  • 1
    @a.toraby it can be to avoid the http password (when using passphrasee-less private ssh keys), or to avoid settings up an http server (since most Linux system have a running ssh daemon already) – VonC Mar 23 '15 at 20:30
2

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.

0

One of my colleagues was facing the same issue. For him, it was the issue with setting the SSH. It seems like the credential used was incorrect. And just cleaning that resolved that issue.

$ git config --system --unset credential.helper
$ git config --global --unset credential.helper

Thanks to Patthoyts for this answer.

Sibeesh Venu
  • 18,755
  • 12
  • 103
  • 140
  • This has nothinng to do with this question, which uses an SSH URL. A credentiual helper is for caching credentials (username/password) for HTTPS URLs only. – VonC Jul 28 '18 at 14:51