Created
May 11, 2020 09:14
-
-
Save oshimayoan/0654140cae4205a76e17c85b36fb5bd4 to your computer and use it in GitHub Desktop.
CircleCI config.yml for mirroring a sub-directory from Github repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: 2.1 | |
| jobs: | |
| mirror: | |
| docker: | |
| - image: circleci/node:lts | |
| steps: | |
| - checkout | |
| - run: | |
| name: Prepare for mirroring | |
| command: | | |
| git config --global user.email "your.github@email.com" | |
| 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 filter-branch --prune-empty --subdirectory-filter ${SUB_DIR_NAME} ${BRANCH} | |
| git remote add mirror git@github.com:oshimayoan/something-mirror.git | |
| git push mirror master | |
| 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