Creating mirror of PX4 firmware git repo

Hey there,

So I’m looking to create a mirror of the PX4 Firmware repo on our local file server. Currently, my process is:

  1. Initialise a bare repo on the file server using:

git init --bare

  1. Clone PX4/Firmware onto my local machine using:

git clone https://github.com/PX4/Firmware.git

  1. Change the origin of the repo using:

git remote set-url origin user@10.0.0.1:/path/to/repo

  1. Push the repo to my local file server using:

git push user@10.0.0.1:/path/to/repo

  1. Make a new directory somewhere on my local machine and clone the repo from my file server using:

git clone user@10.0.0.1:/path/to/repo

  1. Initialise all of the submodules using:

git submodule update --init --recursive

  1. Attempt a firmware build using:

make px4_fmu-v5_default

I would expect this to build correctly, however, it seems that the PX4 version is wrong. The error output is:

Error: the git tag '62e2f5050f' does not match the expected format.

    The expected format is 'v<PX4 version>[-<custom version>]'
      <PX4 version>: v<major>.<minor>.<patch>[-rc<rc>|-beta<beta>]
      <custom version>: <major>.<minor>.<patch>
    Examples:
      v1.9.0rc3 (deprecated)
      v1.9.0-rc3 (preferred)
      v1.9.0-beta1
      v1.9.0-1.0.0
    See also https://dev.px4.io/master/en/setup/building_px4.html#firmware_version

I don’t have this issue when I build before I push to the fileserver. After a bit of digging around, I found out that the git tag ‘62e2f5050f’ is actually the first 10 digits of the PX4_GIT_VERSION_STR variable defined in the build/px4_fmu-v5_default/src/lib/version/build_git_version.h file in the repo before it was pushed to the local fileserver. Seems a bit coincidental to me but I don’t really know what’s going on.

Does anybody know what the issue might be? Thanks in advance.

Managed to solve this issue by changing the command in step 4 to:

git push --mirror user@10.0.0.1:/path/to/repo

This command seems to have ensured that all refs under /refs (including /refs/tags) are also mirrored to the new repository.

2 Likes