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
- Host: GitHub
- URL: https://github.com/xtream1101/mirror-to-gitlab
- Owner: xtream1101
- Created: 2020-10-24T05:13:32.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-10-26T13:43:28.000Z (over 4 years ago)
- Last Synced: 2025-04-09T17:15:12.699Z (about 2 months ago)
- Topics: backup, bash, git, gitlab, mirroring
- Language: Shell
- Homepage:
- Size: 7.81 KB
- Stars: 8
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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`