DEV Community

loading...
Cover image for Mirror a sub-directory GitHub repo with CircleCI
KodeFox, Inc.

Mirror a sub-directory GitHub repo with CircleCI

Yoan Pratama Putra
Software Engineer @KodeFox | Google Assistant Enthusiast | Road Cyclist | Nerd
・1 min read

Last time, I was talking about Mirroring a Github Repo with CircleCI. That article was about mirroring the whole repository using git clone --bare command. By using that git command, we not just mirror the whole content but also all branches from the repository.

There are times that we want to only mirror a sub-directory from the main repository. We can achieve that easily by using a special command by "git".

So today I will share what I learned mirroring a sub-directory from a GitHub repository using CircleCI.

This time we don't need to generate an SSH key. We will use CircleCI's checkout command as we need the CI to clone our repository normally, not bare.

Add the code below into your "config.yml" and CircleCI will do the magic for you.

We're done! Actually, this is a lot easier than the previous one as there is almost no setup this time.

You can push a commit now to make the CircleCI mirror your sub-directory into another repository.

Discussion (0)