Jenkins can’t authenticate via SSH in Git

Asked

Viewed 1,075 times

4

I climbed a Jenkins into an Ubuntu Server 13 VM and I’m trying to create a job so I can clone a repository via SSH. Credentials are already configured and via the command line works perfectly.

Credencial Criando Job Configuração do Job Output no Console

Missing any step or configuration?

WORKAROUND I removed the password from the public key and it worked, but there is still a need to use it encrypted.

  • Make sure you put the Jenkins user’s public key into Git.

  • @rodrigorigotti put yes. Thank you.

  • Are you running Jenkins with the same user who cloned via shell? I know everyone is circulating the same questions, but it seems like some other little slip like this is really a problem with Jenkins/git

  • @mollusk who makes the clone, in the way I’m trying to do, is Jenkins himself (with the user Jenkins), and after I removed the password from the public key worked perfectly. The problem is Jenkins passing the configured password to the shell. Thank you!

4 answers

2

I believe you forgot to put the protocol git:// in the field Repository URL check if port 23 or is 22 from the server is open.

  • +1 - is another thing that may be going wrong here.

  • Luiz Filipe that doesn’t need, Jenkins already understands how it is. Thank you.

  • @Marcelofilho what if the door that this protocol use in the server where the Jenkins is closed? Checked if it is open, checked if there are any firwall at the site?

  • @Filipe yes, as I said, via command-line works perfectly.

  • Marcelo user name is jenkins same? Git repository is on github or bitbucket?

  • Yes @Filipe is the Jenkins user. The repository is indifferent to this problem because the key is already logged and works via command line (even with the Jenkins user).

Show 1 more comment

0

inserir a descrição da imagem aquiOpa!

Go on Manage Jenkins -> Configure System -> Git and changes to Jgit. It works perfectly. Hugs

  • Has how to put a screenshot?

0

I don’t know exactly how to fix it, but looking good on Console Output, it’s marked using GIT_SSH to set credentials, but you are putting the authentication data in the Jenkins configuration. Will the connection of the Git is using other credentials to connect to the repository?

  • So that’s what I’m not able to define. Anyway I put the public and private Keys of ~/. ssh in the . Jenkins ssh na /var/lib/Jenkins/.ssh. And yet it’s making that mistake. But like I said, I don’t know which one you’re using from.

  • When does echo $GIT_SSH on linux, what is written?

  • Nothing, it is blank.

  • The GIT_SSH is an environment variable. It is usually pointed to a script. For example: export GIT_SSH=/home/me/bin/git_ssh, git_ssh being a script that connects to SSH. I don’t know how your English is, but here are some sources: here, here, and here

  • That’s fine, rsss. Thank you! Ví that he set a GIT SSH pro environment variable: export GIT_SSH="/usr/bin/ssh" I did it in ~/. bashrc and I will test. That would be the solution?

  • It didn’t work, the problem persists.

Show 1 more comment

0

Do the following there is a program called putty that it generates an ssh key from there is just you put that chave ssh in the git follow the steps of this site here: Git ssh Putty only you don’t forget one thing in Jenkins you put add key and in the place of global you put to use the ssh then just add the key you put in git and ready.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.