When deploying code using code manager or r10k, deploying fails, and you get the following error message in the puppetserver log:
ERROR -> Unable to determine current branches for Git source 'puppet' (/etc/puppetlabs/code-staging/environments) Original exception: Object is not a committish
You might also get this error on the command line when running puppet code deploy
with the --wait
flag.
Error messages and logs
In the puppetserver log (/var/log/puppetlabs/puppetserver/puppetserver.log
) or on the command line:
ERROR -> Unable to determine current branches for Git source 'puppet' (/etc/puppetlabs/code-staging/environments) Original exception: Object is not a committish
The error is caused by a reference (ref) in a git database that is not a committish. A committish is a commit or tag object name. When a command takes a committish argument, it treats it as a commit object, but dereferences tag objects pointing at a commit.
The error is raised from libgit, and affects both the rugged
and shellgit
providers for r10k
.
Version and installation information
PE version: Any
OS: Any
Installation type: Any
Solution
Find and delete the refs causing the issue.
Note: If you're using Gerrit Code Review, deleting refs might cause issues since the refs are part of its functionality. Please consult Gerrit's documentation before you remove refs. It may be possible to change Gerrit's configuration so that these refs are no longer created. Since Gerrit Code review is a third party product, we cannot provide support for it.
-
On the primary server, run a command to find the refs causing the issue.
For Code Manager:
Run the following command from
/opt/puppetlabs/server/data/code-manager/worker-caches
find . -type d -name "*.git" -exec bash -c "cd {} && echo "{}" && git for-each-ref --format '%(refname) %(objecttype)'" \;
For r10k (using the default cache):
Run the following command from
/var/cache/r10k
find . -type d -name "*.git" -exec bash -c "cd {} && echo "{}" && git for-each-ref --format '%(refname) %(objecttype)'" \;
Note: If you’ve customized the r10k cache location, run the command from the location set in Hiera.
The command produces output like this:
./https---git.company.com-puppet-controlrepo.git refs/cache-automerge/06/79df6dabd8a79d8f9873223a6ecde31d1bf56f tree refs/cache-automerge/13/dd1eefd511cc84877384de525c500dafb12bc6 tree refs/changes/00/1700/1 commit refs/changes/00/600/1 commit refs/changes/01/1201/1 commit refs/changes/01/1401/1 commit refs/changes/01/1401/2 commit refs/changes/01/1701/1 commit refs/changes/02/102/1 commit refs/changes/02/102/2 commit refs/changes/02/1302/1 commit refs/changes/02/1602/1 commit refs/changes/02/1702/1 commit refs/changes/02/2/1 commit refs/changes/02/202/1 commit refs/changes/02/802/1 commit refs/changes/03/1103/1 commit refs/changes/03/1303/1 commit refs/changes/03/1303/2 commit
The following refs are not committish objects:
refs/cache-automerge/06/79df6dabd8a79d8f9873223a6ecde31d1bf56f tree refs/cache-automerge/13/dd1eefd511cc84877384de525c500dafb12bc6 tree
-
Delete the refs causing the issue. Run the following command from any machine (it doesn't need to be the primary server) on a checked out version of the affected Git repository, making sure to replace the refs with the ones you found in the last step:
git push origin :refs/cache-automerge/06/79df6dabd8a79d8f9873223a6ecde31d1bf56f git push origin :refs/cache-automerge/13/dd1eefd511cc84877384de525c500dafb12bc6
How can we improve this article?
0 comments
Please sign in to leave a comment.
Related articles