I am using git server in ubuntu. I have another server in other place. Now I have to sync the file between this two git servers every day morning 6 am. how to do this one. because i am new one for git.
First, make a mirrored clone of the repository on the second server. A mirrored repository is one that looks exactly like its origin, rather than having remote branches corresponding to the ones in the origin. git help clone explains it better than I do:
Set up a mirror of the source repository. This implies --bare. Compared to --bare, --mirror not only maps local branches of the source to local branches of the target, it maps all refs (including remote-tracking branches, notes etc.) and sets up a refspec configuration such that all these refs are overwritten by a git remote update in the target repository.
So make your mirror:
git clone --mirror git://example.com/repo.git
Then all your cron job has to do is a git fetch:
cd repo.git
git fetch
The repo remembers where it was cloned from and fetches from there by default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With