(Redirected from GitLab/GitHub)

Gitlab project

gitlab project

Deploying from Gitlab CI/CD to

There is a user qemu-deploy on for CI/CD jobs that need to deploy to the web root. The private key is stored into a file variable SSH_PRIVATE_KEY_FILE of the qemu and qemu-web GitLab repositories. If you need it for any reason (you shouldn't), please ask the owners for the GitLab organization.

If you need to use the key, also please coordinate with owners to have a "temporary" private key added to ~qemu-deploy/.ssh/authorized_keys first (note: the .ssh/authorized_keys file is made immutable with chattr +i). Only switch to the existing private key when everything works. This ensures for example that the private key is not leaked into job logs!

Creating a new repository

To setup a mirror from an upstream repository to Gitlab:

  1. Create the new repository on
  2. Click Settings->Repository
  3. Expand "Mirroring repositories"
  4. When creating the Pull mirroring rule, choose "Keep divergent refs"

To mirror the repository to GitHub, you will need admin access on Gitlab and GitHub.

  1. Create the new repository on
  2. Do not close GitHub, open the source repo
  3. Click Setting->Repository
  4. Expand "Mirroring repositories"
  5. Set "Git repository URL" to ssh://
  6. Set "Mirror direction" to Push
  7. Click "Detect host keys"
  8. Set "Authentication method" to "SSH public key"
  9. Click "Mirror repository"
  10. Click the suitcase icon ("Copy SSH public key")
  11. Go back to GitHub, do not close Gitlab
    1. Click Settings (on the top bar with Code, Issues, etc.)
    2. Click Deploy keys (on the left column)
    3. Click "Add deploy key"
    4. Type whatever you want for Title ("gitlab mirroring"), paste into key
    5. Click "Allow write access"
    6. Click "Add key"
  12. On Gitlab click the retry icon

To mirror the GitLab repository from, you will need root access on

cd /srv/git
git init --bare $REPONAME
mv hooks/post-update.sample hooks/post-update
git remote add --mirror=fetch gitlab$REPONAME
git config remote.gitlab.mirror true
echo $REPONAME >> ~gituser/repos

GitHub project

github organization