简体   繁体   中英

Setup local git server sync with remote

I need a local git server (bare) that auto-sync itself with target remotes. like:

(clone1) --|                                   |-- (remote1.git)

..       --|                                   |-- ...

(cloneN) --|       <==> (local.git) <==>       |-- (remoteM.git)

You can't do that. If you want to pull changes from a remote repository you must issue the git pull (origin) command: - https://git-scm.com/docs/git-pull - https://www.quora.com/What-are-the-differences-between-git-pull-git-pull-origin-master-and-git-pull-origin-master

If you want to push a local branch to a remote repository, you must use git push: - https://www.edureka.co/community/33214/git-push-vs-git-push-origin - https://git-scm.com/docs/git-push

You can specify which remote you want to sync with. Default is origin.

Branches usually don't push/pull themself, since sometimes you'll need to resolve conflicts

Git is not based upon pull content every once in a while.
A workaround can be to add a schedules job (on cloneX) to fetch/pull every few minutes

Another option, if you are using Unix, is to use https://myrepos.branchable.com to update all your repositories, again with a scheduled task or job.

Basically, you need to do the pulling yourself since git does not work this way.

Other options:

Read this excellent blog post:

https://moox.io/blog/keep-in-sync-git-repos-on-github-gitlab-bitbucket/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM