Created
February 23, 2024 09:58
-
-
Save thomaswienecke/714d00417798767d8747df72c0a58b2b to your computer and use it in GitHub Desktop.
Mirror Github Repository to Gitlab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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