SCM Sync configuration plugin doesn't commit/push

匿名 (未验证) 提交于 2019-12-03 08:54:24

问题:

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

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

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?

回答1:

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.



回答2:

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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!