Skip to content

Action for synchronizing a git branch to another location (Bitbucket, GitHub, GitLab, etc.) using SSH.

License

Notifications You must be signed in to change notification settings

estevao90/sync-git-branch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sync Git Branch Action

A GitHub Action for synchronizing a git branch to another location via SSH.

Inputs

Name Description Default Required
source-branch Branch name in the source repository Yes
destination-repo SSH URL of the destination repository Yes
source-repo SSH URL of the source repository The respository this action runs in No
destination-branch Branch name in the destination repository Same as source-branch No

Environment variables

SSH_PRIVATE_KEY: Create a SSH key without a passphrase which has access to both repositories.

On GitHub you should add the public key to repository "deploy keys".

Store the private key as a secret and use it in your workflow as seen in the example usage below.

Example workflow

name: Sync main branch to Bitbucket

on: [push, delete, create]

jobs:
  git-mirror:
    runs-on: ubuntu-latest
    steps:
      - uses: zent-contrib/sync-git-branch@v1
        env:
          SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
        with:
          source-branch: main
          destination-repo: "git@bitbucket.org:<org>/<repo>.git"

About

Action for synchronizing a git branch to another location (Bitbucket, GitHub, GitLab, etc.) using SSH.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 82.0%
  • Dockerfile 18.0%