jbrunoxd
jbrunoxd

Reputation: 222

Jenkins Git connection

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?

Upvotes: 1

Views: 545

Answers (1)

VonC
VonC

Reputation: 1323343

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.

Upvotes: 1

Related Questions