Simulate SCM Backup’s Git usage

If something goes wrong in the moment when SCM Backup is actually trying to backup your repos, you can manually do the same steps to verify if they work directly in Git.

(if they don’t, the problem may be caused by an issue with your local Git installation)

SCM Backup does this:

  1. If the local repo doesn’t exist yet, create an empty one:

    git init --bare "/local-backup-dir/"
  2. Fetch everything from the remote repo into the local repo that is not there yet:

    git -C "/local-backup-dir/" fetch --force --prune refs/heads/*:refs/heads/* refs/tags/*:refs/tags/*

Of course, /local-backup-dir/ must be a valid path for your operating system (e.g. c:\example\ for Windows).

SCM Backup fails with strange errors

There were already multiple issues that I (SCM Backup maintainer) couldn’t reproduce so far: #33, #57, #58, #66

Things that almost all issues have in common:

  • Always: the hoster is Bitbucket

  • Often: Git fails with this error:

    fatal: protocol error: unexpected 'Error running git: fork/exec /usr/bin/git-upload-pack: no such file or directory'
  • Often: SCM Backup is executed on Windows

  • Sometimes: people tried to ignore the repo that caused the error, only to have the same error occur for another repo, and another…

Other things worth mentioning:

  • one of the failing repos had about 500 branches and tags, some of the branches had very long names

  • one of the failing repos was completely empty

  • many different Git versions were used, so apparently it’s not a bug in a specific Git version or something like that

If you have a similar problem, please try these steps:

  1. Enable logRepoFinished to be 100% sure which repo is the culprit

  2. Execute the steps SCM Backup does directly in Git, with the repo where the problem occured


    Until now, executing the commands in Git directly did work for all users who had the problem with SCM Backup. But still, it’s interesting to know.

  3. Try to ignore the repo.

    This helped for some people…for others, the same problem occured with multiple other repos.

I don’t have a working solution for this problem yet, because I wasn’t able to reproduce it myself.