Is it possible to push one project to both Github and Bitbucket using vscode?

Viewed 73

I have a project that I imported to Bitbucket from Github. But pushing to my Github doesn't automatically push that to the imported repository on Bitbucket. Is there a way to do that, through vscode?

1 Answers

You could use a GitHub action which, on push, would automatically mirror the pushed content to BitBucket:

actions/mirroring-repository.

name: Mirroring

on: [push, delete]

jobs:
  to_gitlab:
    runs-on: ubuntu-latest
    steps:                                              # <-- must use actions/checkout before mirroring!
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: pixta-dev/repository-mirroring-action@v1
        with:
          target_repo_url:
            git@gitlab.com:<username>/<target_repository_name>.git
          ssh_private_key:                              # <-- use 'secrets' to pass credential information.
            ${{ secrets.GITLAB_SSH_PRIVATE_KEY }}

But that supposes you are not working at the same time on your Bitbucket old repository.

Since the GitHub action is defined on GitHub, it does not matter the push is done from VSCode or command line.

Related