Search code examples
gitrepogpg-signature

Disable GPG signature check for repo init (and/or for git)


I'm trying to setup an AOSP repository with the repo init command, however I get a signature checking error (I edited out all the actual names and object IDs):

repo: error: "git" failed with exit status 1
  cwd: /aoap/.repo/repo
  cmd: ['git', 'tag', '-v', 'v1.12.16']
  stdout:
  >> object 0123456789abcdef0123456789abcdef01234567
  >> type commit
  >> tag v1.12.16
  >> tagger Foo Bar <foobar@android.com> 0123456789 -0700
  >> 
  >> repo 1.12.16
  stderr:
  >> gpg: Signature made gio 31 feb 2022, 12:34:56 CEST
  >> gpg:                using RSA key 0123456789ABCDEF
  >> gpg: Can't check signature: No public key
fatal: cloning the git-repo repository failed, will remove '.repo/repo'

Is there a way to skip or disable the GPG signature check (for this repo init, or even globally for git)?


Solution

  • Check first if a global config (just for the time of the repo init command) would help

    git config --global tag.gpgSign false
    git config --global commit.gpgSign false
    

    If this is not working (since it is likely for creating tag/commit, rather than checking them), check the configuration gpg.program

    By replacing it with a script which always return 0, you might (again just for the repo init) bypass any gpg check

    git config --global gpg.program myGpg
    

    With myGpg an executable bash script on the $PATH% with

    #!/bin/bash
    exit 0