Jenkins SCM Sync Configuration Plugin In Docker Won't Talk to Github
I’m creating an image from the Jenkins Docker image and trying to install the SCM Sync Configuration Plugin. I have a key created that I’m copying to the image that is also copied to the ssh keys for the Github repo. I’ve tried creating
.ssh/ folders in
/root as well as
/var/jenkins_home. I followed this example and tried adding both of the keys to
/etc/ssh/ssh_config. This didn’t work. I also tried following another answer (lost the link to it) where you can add a
config file to
.ssh/ containing something like this:
Host github HostName github.com User git IdentityFile "/var/jenkins_home/.ssh/id_rsa"
This also didn’t work. I’m using the credentials plugin + Git plugin and the credentials entry points at the
- Permission denied (public key) during fetch from GitHub with Jenkins user on Ubuntu
- Error in Jenkins connection to stash
- Jenkins - Make heavy job wait for a certain number of executors to be available
- git plugin on windows command fails from Jenkins, succeeds in shell
- Jenkins: How do I use the Parameterized Trigger Plugin and pass a subversion revision?
- TeamCity push feature branches to master branch
Has anyone gotten this plugin or git integration in general working with Jenkins in a Docker image? The errors I get are as follows:
INFO: Creating SCM repository object for url : firstname.lastname@example.org:MY_REPO/scm-sync.git
Nov 25, 2014 4:20:30 AM hudson.plugins.scm_sync_configuration.scms.SCM getConfiguredRepository
SEVERE: Error creating ScmRepository : No such provider: ‘github.com’.
Nov 25, 2014 4:20:30 AM jenkins.model.Jenkins
java.lang.RuntimeException: Error during ScmSyncConfiguration initialisation !
Caused by: java.lang.NullPointerException
… 5 more
3 Solutions collect form web for “Jenkins SCM Sync Configuration Plugin In Docker Won't Talk to Github”
We use our docker jenkins container with github extensively. We have not had this issue.
We don’t need to manually setup the key in the container, just using the credentials plugin. Give this container a shot and let me know what errors you get?
The steps to setup in the UI are:
- Install the Credentials Plugin and the Github Plugin
- Click Mange credentials in Manage Jenkins page
- Add your private key and give it a name
- Reference the key by name in your job
Just want to point out that the accepted answer is not the answer to this problem. The SCM sync plugin does not use the credentials plugin. So to be able to access your SCM sync repo, you need to…
- Generate an ssh key using
- Go to your github repo settings and add a
deploy key. Copy the public key
id_rsa.pubgenerated in previous
- If you have already setup your SCM sync settings, you will need to unselect your current git repo and then re-add it.
Credit goes to this blog post: https://cburgmer.wordpress.com/2013/01/02/tracking-configuration-changes-in-jenkins/
Note: Inside a docker container the steps are the same. I just add the
id_rsa to the container by mounting my host’s system
.ssh folder as a volume.
docker run -v /my-user/.ssh:/root/.ssh my-container
Here is my solution and it works for SURE.
Go set up a personal token in github and you will get a token for example 123456abc.
In SCM sync plugin put