1

Getting this error while setting the git config in the Source Code Management section, the repository url is private like this exampleip:/home/project/git-repo/single_login.git not from github

Failed to connect to repository : Command "git ls-remote -h exampleip:/home/project/git-repo/single_login.git HEAD" returned status code 128:
stdout:
stderr: Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.

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

i tried setting up username and password in the jenkins credential provider and still doesnt work.

the clone that i do for the project in terminal was like this git clone username@exampleip:/home/project/git-repo/single_login.git this ask for password that once supplied it works

i think that somehow he is inputing the user/pass in a wrong way, anybody have an idea about this?

jbrunoxd
  • 222
  • 1
  • 6
  • 14

1 Answers1

1

An scp-like ssh URL exampleip:/home/project/git-repo/single_login.git means the account running Jenkins will look for an ~/.ssh/config file, with an Host exampleip entry.

Host exampleip
  HostName exampleip.ip
  User username
  IdentityFile /path/to/id_rsa_username

Make sure id_rsa_username.pub is registered to your remote example server, at ~username/.ssh/authorized_keys. Then it will work.

But you need to make sure of who is running Jenkins, in order to set the ~/.ssh/config file at the right place.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • thanks with this config in the ~/.ssh/config file with the user jenkins i was able to connect to the server – jbrunoxd Aug 09 '17 at 11:55