Skip to content

Instantly share code, notes, and snippets.

@thomaswienecke
Created February 23, 2024 09:58
Show Gist options
  • Save thomaswienecke/714d00417798767d8747df72c0a58b2b to your computer and use it in GitHub Desktop.
Save thomaswienecke/714d00417798767d8747df72c0a58b2b to your computer and use it in GitHub Desktop.
Mirror Github Repository to Gitlab
name: Sync to GitLab
on:
push:
branches:
- "main"
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Push To Gitlab
run: |
git status
echo "Starting to push repo to gitlab"
git config user.name "<<YOUR NAME>>"
git config user.email "<<YOUR EMAIL>>"
git remote set-url origin "https://oauth2:${token}@<<gitlab-repo-url (clone-url without protocol)>>"
git push -f origin main
env:
# Generate an access_token in gitlab with "read_repository" and "write_repository" scopes
token: ${{ secrets.GITLAB_ACCESS_TOKEN }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment