From: programmerjake Date: Thu, 26 Mar 2020 01:11:32 +0000 (+0000) Subject: git mirroring WIP X-Git-Tag: convert-csv-opcode-to-binary~3066 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8ace29854aa990b6a057c76f7e4df9cc09df0460;p=libreriscv.git git mirroring WIP --- diff --git a/resources/server-setup/git-mirroring.rst b/resources/server-setup/git-mirroring.rst index 9ac9ab9e0..ff9062401 100644 --- a/resources/server-setup/git-mirroring.rst +++ b/resources/server-setup/git-mirroring.rst @@ -1,3 +1,60 @@ -============= -Git Mirroring -============= +======================= +Git Mirroring to GitLab +======================= + +Steps for setting up automatic mirroring cron jobs: + +* Add a new user: + + .. code-block:: bash + + sudo adduser --disabled-login --system git-mirroring + +* Start a shell as the `git-mirroring` user: + + .. code-block:: bash + + sudo -H -u git-mirroring /bin/bash + +* Switch to home directory: + + .. code-block:: bash + + cd + +* Create an executable file `sync.sh` (replace `nano` with the editor of your choice): + + .. code-block:: bash + + touch sync.sh + chmod +x sync.sh + nano sync.sh + + * Type in the following contents: + + .. code-block:: bash + + #!/bin/sh + for repo in ~/*.git; do + cd "$repo" && git fetch -q && git push -q gitlab || echo "sync failed for $repo" + done + + * Save and exit the editor. + +* Create a ssh key: + + .. code-block:: bash + + ssh-keygen + + Press enter for all prompts -- leaving the file names as default and with an empty password. + +* For each repo to be mirrored: + + * Create an empty repo using the GitLab website. + + .. warning:: + + Following these steps will overwrite anything that is in the GitLab repo. + + * Add the