Skip to content

Commit

Permalink
Merge pull request #394 from mbeps/development
Browse files Browse the repository at this point in the history
FIX: ! [remote rejected] main -> main (shallow update not allowed)
  • Loading branch information
mbeps authored Jun 10, 2024
2 parents 8d61af7 + 969a922 commit 13de148
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v2
with:
fetch-depth: '0'

- name: Verify
- name: Verify GitLab Repository
env:
GITLAB_ACCESS_TOKEN: ${{ secrets.GITLAB_ACCESS_TOKEN }}
GITLAB_USERNAME: ${{ secrets.GITLAB_USERNAME }}
Expand All @@ -22,21 +24,18 @@ jobs:
git config --global user.name 'Maruf Bepary'
git config --global user.email '[email protected]'
# Attempt to list the remote repository
git ls-remote https://oauth2:${GITLAB_ACCESS_TOKEN}@gitlab.com/${GITLAB_USERNAME}/${GITLAB_REPOSITORY}.git HEAD
if [ $? -ne 0 ]; then
echo "Failed to connect to GitLab repository. Check if repository exists and credentials/token are correct."
exit 1
fi
- name: Mirror Repository
- name: Mirror Repository to GitLab
env:
GITLAB_ACCESS_TOKEN: ${{ secrets.GITLAB_ACCESS_TOKEN }}
GITLAB_USERNAME: ${{ secrets.GITLAB_USERNAME }}
GITLAB_REPOSITORY: ${{ secrets.GITLAB_REPOSITORY }}
run: |
# Setup if the initial check is successful
git remote add gitlab https://oauth2:${GITLAB_ACCESS_TOKEN}@gitlab.com/${GITLAB_USERNAME}/${GITLAB_REPOSITORY}.git
git remote add gitlab https://oauth2:${GITLAB_ACCESS_TOKEN}@gitlab.com/${GITLAB_USERNAME}/${GITLAB_REPOSITORY}.git || true
# Push code to GitLab
git push gitlab main
git push --force gitlab main

0 comments on commit 13de148

Please sign in to comment.