Configuring jenkins using git over ssh

I am trying to configure jekins using git over ssh.

Standard start:

git clone ssh://[username]@[server]/srv/git/[repo]

after putting password cloning is cloned on my disk.

Now about jenkins

ssh://[username]@[server]/srv/git/[repo].git

Failed to connect to repository : Command "git -c core.askpass=true ls-remote -h ssh://[username]@[server]/srv/git/[repo].git HEAD" returned status code 128:
stdout:
stderr: Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
fatal: Could not read from remote repository.

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

enter image description here

enter image description here

otherwise enter image description here

+4
source share
4 answers

You are connecting via SSH, which probably means that you have configured a password based on the key so that you can connect without a password. (Move ~ / .ssh / id_rsa to another location, and I'm sure you will be asked to enter a password if you also clone git.)

, Jenkins . / jenkins git Jenkins.

: fooobar.com/questions/498206/...

+1

, "SSH Username with private key". " Jenkins" ~/.ssh/some-project-specific-directory/id_rsa.

, 1.637 ( "~" ). , (, /var/lib/jenkins/.ssh/some-project-specific-directory/id_rsa), .

+1

. git , , .

git. , , git , , .

+1

Just add the password to the 'passphrase' section when you add the ssh key because you have a private key, but you still need a password to connect to the repo.

See image below.

-2
source

Source: https://habr.com/ru/post/1583969/


All Articles