Jenkins Fixing SCM Sync with Git and Failing with Delete Jobs

https://wiki.jenkins-ci.org/display/JENKINS/SCM+Sync+configuration+plugin

I have encountered this several times where if you try and change a job name along with any configuration for a job Git will get into a bad state and the SCM will start throwing up errors like:

delete Jobs/OLD_JOB_NAME 

The only thing I have found is to fix this is to follow the following steps:

You will have to have admin rights and the ability to restart your jenkins.

  1. recreate the OLD_JOB_NAME
  2. change the system configuration scm sync to none.
  3. restart the jenkins.  via your_jenkins_server/restart
    1. change the system configuration scm sync to git.
  4. Ensure that the configuration is now syncing correctly  and you do not have any more errors.
  5. delete OLD_JOB_NAME again.
  6. If this still does not work you can try downgrading the plugin and repeating the steps again.

Warning:

You may lose all your job configurations after you reenable the SCM sync so you will have to make a small change to each job name such as changing the description by a single letter.

 

 

Advertisements

2 thoughts on “Jenkins Fixing SCM Sync with Git and Failing with Delete Jobs

  1. santosh verma

    I have better solution 🙂
    As I have deleted so many jobs, so i couldn’t try above steps.
    What I did:

    1: Login to jenkins master with Jenkins user:
    2: go to /var/lib/jenkins/scm-sync-configuration/checkoutConfiguration folder ( may be different in your case )
    3: run command git status.
    4: Manually add, commit and pushed the changes.

    And it’s start working … 🙂

    Reply
    1. onekilo79 Post author

      Both solutions work. Yours is much better if you can shell onto the jenkins master node. Mine I came up with because I was unable gain access to master.

      Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s