Gitlab/GitHub: Difference between revisions

From QEMU
Line 6: Line 6:
There is a user qemu-deploy on qemu.org for CI/CD jobs that need to deploy to the qemu.org web root.  The private key is stored into a file variable SSH_PRIVATE_KEY_FILE of the [https://gitlab.com/qemu-project/qemu qemu] and [https://gitlab.com/qemu-project/qemu-web qemu-web] GitLab repositories.  If you need it for any reason (you shouldn't), please ask the [[AdminContacts|owners for the GitLab organization]].
There is a user qemu-deploy on qemu.org for CI/CD jobs that need to deploy to the qemu.org web root.  The private key is stored into a file variable SSH_PRIVATE_KEY_FILE of the [https://gitlab.com/qemu-project/qemu qemu] and [https://gitlab.com/qemu-project/qemu-web qemu-web] GitLab repositories.  If you need it for any reason (you shouldn't), please ask the [[AdminContacts|owners for the GitLab organization]].


=== Instructions to create a push mirror to GitHub ===
=== Creating a new repository ===
You will need admin access to both Gitlab and GitHub.
You will need admin access on Gitlab, GitHub and qemu.org.


To mirror the repository to GitHub:
#Create the new repository on https://github.com/qemu
#Create the new repository on https://github.com/qemu
#Do not close GitHub, open the source repo https://gitlab.com/qemu-project/projectname
#Do not close GitHub, open the source repo https://gitlab.com/qemu-project/projectname
Line 27: Line 28:
##Click "Add key"
##Click "Add key"
#On Gitlab click the retry icon
#On Gitlab click the retry icon
To mirror the GitLab repository from qemu.org:
<pre>
REPONAME=repo.git
cd /srv/git
git init --bare $REPONAME
mv hooks/post-update.sample hooks/post-update
git remote add --mirror=fetch gitlab https://gitlab.com/qemu-project/$REPONAME
git config remote.gitlab.mirror true
echo $REPONAME >> ~gituser/repos
</pre>


== GitHub project ==
== GitHub project ==
[https://github.com/qemu github organization]
[https://github.com/qemu github organization]

Revision as of 11:25, 19 January 2021

Gitlab project

gitlab project

Deploying from Gitlab CI/CD to qemu.org

There is a user qemu-deploy on qemu.org for CI/CD jobs that need to deploy to the qemu.org 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.

Creating a new repository

You will need admin access on Gitlab, GitHub and qemu.org.

To mirror the repository to GitHub:

  1. Create the new repository on https://github.com/qemu
  2. Do not close GitHub, open the source repo https://gitlab.com/qemu-project/projectname
  3. Click Setting->Repositopry
  4. Expand "Mirroring repositories"
  5. Set "Git repository URL" to ssh://git@github.com/qemu/projectname.git
  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 qemu.org:

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

GitHub project

github organization