Skip to content

Instantly share code, notes, and snippets.

@oshimayoan
Created February 1, 2020 03:31
Show Gist options
  • Save oshimayoan/78ab48916f2d0b63d8062249f1c581f2 to your computer and use it in GitHub Desktop.
Save oshimayoan/78ab48916f2d0b63d8062249f1c581f2 to your computer and use it in GitHub Desktop.
CircleCI config.yml for mirroring Github repo
version: 2.1
jobs:
mirror:
docker:
- image: circleci/node:lts
steps:
- add_ssh_keys:
fingerprints:
- YOUR_FINGERPRINT_HERE
- run:
name: Prepare for mirroring
command: |
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
# Need to create .ssh dir in case it doesn't exists
mkdir -p ~/.ssh
# This too
touch ~/.ssh/known_hosts
# To avoid prompt when doing ssh connection
ssh-keyscan 'github.com' >> ~/.ssh/known_hosts
- run:
name: Mirroring repo
command: |
git clone --bare [email protected]:oshimayoan/something.git
cd something.git
git push --mirror [email protected]:oshimayoan/something-mirror.git
workflows:
main:
jobs:
- mirror:
filters:
branches:
only: master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment