git连接jenkins_Jenkins Git连接

bd96500e110b49cbb3cd949968f18be7.png

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?

解决方案

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.


版权声明:本文为weixin_39624980原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。