gitlab 登录

新建空白项目

得到 GITLAB_PAT glpat-sWZjDWp5ruPVYXL_RTPo

=============================================

Github 设置

GITLAB_USERNAME zb9678
GITLAB_REPO Gitlab zb9678.github.io1
GITLAB_PAT glpat-sWZjDWp5ruPVYXL_RTPo

Github 设置同步 sync-to-gitlab.yml


sync-to-gitlab.yml  内容

name: Sync to GitLab

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  sync:
    runs-on: ubuntu-latest

    env:
      GITLAB_USERNAME: ${{ secrets.GITLAB_USERNAME }}
      GITLAB_REPO: ${{ secrets.GITLAB_REPO }}
      GITLAB_PAT: ${{ secrets.GITLAB_PAT }}

    steps:
    - name: Checkout repository
      uses: actions/[email protected]
      with:
        fetch-depth: 0

    - name: Set up Git
      run: |
        git config --global user.name 'github-actions'
        git config --global user.email '[email protected]'

    - name: Add GitLab remote
      run: git remote add gitlab https://${{ env.GITLAB_USERNAME }}:${{ env.GITLAB_PAT }}@gitlab.com/${{ env.GITLAB_USERNAME }}/${{ env.GITLAB_REPO }}.git

    - name: Force push to GitLab
      run: git push gitlab main --force

gitlab 删库

转载请注明出处