An open API service indexing awesome lists of open source software.

https://github.com/xtream1101/mirror-to-gitlab

Mirror repos to a gitlab server
https://github.com/xtream1101/mirror-to-gitlab

backup bash git gitlab mirroring

Last synced: about 2 months ago
JSON representation

Mirror repos to a gitlab server

Awesome Lists containing this project

README

        

# Mirror git repos to Gitlab

This script will mirror any git repo to a gitlab server. This repo is setup to run the gitlab ci pipeline on a cron job to get updates from all repos.

## Requirements
- bash
- git
- curl
- Environment Variables:
```bash
# Fill in the values with your info to use the script

# gitlab user access token, needs api & write repo permissions
export MIRROR_GITLAB_TOKEN=
# URL that will be the new remote of the repo (minus the name). NOTE: NO `/` at the end
export MIRROR_GITLAB_DOMAIN=
export MIRROR_GITLAB_URL=https://gitlab-ci-token:${MIRROR_GITLAB_TOKEN}@${MIRROR_GITLAB_DOMAIN}/
# The group id you want the mirrors to save to
export MIRROR_GITLAB_NAMESPACE_ID=

# Optional
# Clone the repo into this directory, will use local dir if not set
export MIRROR_PATH=/foo/bar
# If set to true, it will delete the locally cloned git repo. Default is false
export MIRROR_CLEANUP=false
```

## Usage
- Add repos, 1 per line in a file called `repos.txt`
- Run to mirror all repos in the file `./mirror-to-gitlab.sh`