Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SCM Sync configuration plugin doesn't commit/push

I have installed SCM Sync configuration plugin(0.0.10) to save my jenkins settings in my git repository.

I have set the git url repository but the plugin does not commit/push, see the screenshot

enter image description here

I tried:

  • The private key is in ~/.ssh/id_rsa with the chmod 600
  • The root user is own of the id_rsa and the .ssh directory
  • The .ssh directory has the permission 700
  • I did the same for jenkins OS user
  • I can clone the repository(from the console) using the ssh private key, so this means that everything is working

The screenshot of the plugin's status message

enter image description here

as you can see, the plugin copy all the files to the folder that I imagine this folder should be the git repository.

The plugin webpage (https://wiki.jenkins-ci.org/display/JENKINS/SCM+Sync+configuration+plugin) we can see the same "error" and the message To use a Git server with SSH, you have to accept the server SSH key before using the plugin (same for using Git in Jenkins jobs)., OK, but I guess I already did.

The plugin's Troubleshootings says the it uses ~/.ssh/ to commit the settings

https://wiki.jenkins-ci.org/display/JENKINS/ScmSyncConfig+Troubleshootings

I really like the plugin idea and I'd like to use it but I can't.

I use ubuntu 14.04 at AWS and my git repository is bitbucket.

What's wrong?

like image 980
Rodrigo Rodrigues Avatar asked Oct 19 '22 03:10

Rodrigo Rodrigues


2 Answers

I solved the issue, it didn't work because Jenkins was using the OS user Tomcat7, to check what OS user the Jenkins is using just go to option in Jenkins Manage jenkins > System Information and look for user.name, my case was tomcat7.

To solve just check the path of the user, the path can be found in user.home , in my case was /usr/share/tomcat7 and I just copy the ssh key files to /usr/share/tomcat7/.ssh

The files were

  • /usr/share/tomcat7/.ssh with chmod 700
  • /usr/share/tomcat7/.ssh/id_rsa with chmod 600
  • /usr/share/tomcat7/.ssh/id_rsa.pub with chmod 600

I guess the id_rsa.pub(publick key) is not necessary, after that, the plugin could sync with my repository.

like image 188
Rodrigo Rodrigues Avatar answered Oct 21 '22 00:10

Rodrigo Rodrigues


I was also facing same issue. In my case the user was root and home directory was /var/jenkins_home. I was using bitbucket repository.

First created the public and private key using following command

ssh-keygen -t rsa -C "jenkins@<mydomain>.com"

ps: the file name should be id_rsa, if you provide other file name for your private key this won't work.

Copied public key to bitbucket repo settings -> access keys -> add key

private key to root's home directory /root/.ssh/id_rsa

like image 45
rakeshz Avatar answered Oct 21 '22 00:10

rakeshz