Syncing git repository between github and on-prem server

Hi, guys!
My company has a git server in on-premise environment.
And we are also using github.com.

Is it possible to sync my repository to both GitHub and and the on-prem Git server?
What is the best practice to do this?

You can have as many remotes for your local repository as you want, and push to all of them (assuming you have the right credentials). See Git - Working with Remotes for how to do that.

If you want to automatically synchronize between the repositories you could set up a scheduled Actions workflow that does it. There are some pre-made actions for the purpose (I haven’t used them myself, so I can’t really comment), or you could make your own.

Hi, airtower-luna

Thank you! it is very helpful, I will try it!

1 Like