Branch Indexing fails with 'Could not fetch branches from source' error

Article ID:360048256552
2 minute readKnowledge base


  • After configuring a Multibranch Pipeline job, Branch Indexing fails with:

ERROR: [Thu Jul 30 14:00:15 CDT 2020] Could not fetch branches from source xxxxx-xxxxx-xxxx-xxxx-xxxxx
hudson.plugins.git.GitException: Command "/bin/git fetch --tags --progress --prune origin +refs/heads/*:refs/remotes/origin/*" returned status code 1:
stderr: error: unable to resolve reference refs/remotes/origin/<branchName>: Not a directory
From <branchSourceUrl>
 ! [new branch]      <branchName> -> origin/<branchName>  (unable to update local ref)
error: some local refs could not be updated; try running
 'git remote prune origin' to remove any old, conflicting branches

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(
	at jenkins.plugins.git.AbstractGitSCMSource$
	at jenkins.plugins.git.AbstractGitSCMSource$
	at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(
	at jenkins.plugins.git.AbstractGitSCMSource.retrieve(
	at jenkins.scm.api.SCMSource._retrieve(
	at jenkins.scm.api.SCMSource.fetch(
	at jenkins.branch.MultiBranchProject.computeChildren(
	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(
	at jenkins.branch.MultiBranchProject$
	at hudson.model.ResourceController.execute(


When the Multibranch Pipeline project scans the remote repository, it fetches the git repo data and stores it on the Jenkins controller in a subdirectory of $JENKINS_HOME/caches. It is possible for this cached repository to become corrupt, preventing the scan from finishing successfully. If this occurs, please contact CloudBees Support so they can collect the necessary data to determine root cause. As a workaround, this cached git repo can be safely deleted, which will cause the Multibranch Pipeline plugin to re-fetch the repository data.

The cached git repos are stored under $JENKINS_HOME/caches in a subdirectory consisting of git-<hash(remoteProjectUrl)> + a hashed value of the project repository URL. To identify the correct cache subdirectory for your multibranch pipeline project, run the following script in Jenkins Script Console to compute the hash of the remote URL:

"git-" + Util.getDigestOf("<gitRemoteUrl>")

For example, given a repository URL of "", the cached git repo would be stored under $JENKINS_HOME/caches/git-6a303d5f2e994e8a1507fec7657ea43a

Remove this directory, then manually trigger a scan of the Multibranch Pipeline project from the Jenkins UI. For example,

rm -rf $JENKINS_HOME/caches/git-6a303d5f2e994e8a1507fec7657ea43a

If the scan is successful, a new cache folder will be created.