Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
git-commit

GitHub Action

mirror-repository

v0.3.1

mirror-repository

git-commit

mirror-repository

Automate mirroring of git commits to or from a remote repository, like GitLab, Bitbucket, or another GitHub repository

Installation

Copy and paste the following snippet into your .yml file.

              

- name: mirror-repository

uses: yesolutions/[email protected]

Learn more about this action in yesolutions/mirror-action

Choose a version

mirror-action

A GitHub Action for mirroring your commits to a different remote repository

This project is mirrored on GitLab

Example workflows

Mirror a repository with username/password over HTTPS

For example, this project uses the following workflow to mirror from GitHub to GitLab

on: [push]
  ...
      steps:
        - uses: actions/checkout@v1
        - uses: spyoungtech/mirror-action@master
          with:
            REMOTE: 'https://gitlab.com/spyoungtech/mirror-action.git'
            GIT_USERNAME: spyoungtech
            GIT_PASSWORD: ${{ secrets.GIT_PASSWORD }}

Be sure to set the GIT_PASSWORD secret in your repo secrets settings.

NOTE: by default, all branches are pushed. If you want to avoid this behavior, set PUSH_ALL_REFS: "false"

You can further customize the push behavior with the GIT_PUSH_ARGS parameter. By default, this is set to --tags --force --prune

If something goes wrong, you can debug by setting DEBUG: "true"

Mirror a repository using SSH

Pretty much the same, but use GIT_SSH_PRIVATE_KEY

      steps:
        - uses: actions/checkout@v1
        - uses: spyoungtech/mirror-action@master
          with:
            REMOTE: 'https://gitlab.com/spyoungtech/mirror-action.git'
            GIT_USERNAME: spyoungtech
            GIT_SSH_PRIVATE_KEY: ${{ secrets.GIT_SSH_KEY }}

Be sure you set the GET_SSH_KEY in your repo secrets settings.