3 ms·
What about a script/service to mirror Bitbucket and Github (or others) through webhooks or etc? Was just getting my hands on Homebrew after a fresh OS install
by zemanel 14y ago
What about a script/service to mirror Bitbucket and Github (or others) through webhooks or etc?
Was just getting my hands on Homebrew after a fresh OS install when i hit the Octobummer :-/
- ricardobeat 14y agoYou can push to both at the same time, no need for hooks.
- zalew 14y ago.git/config [remote "bitbucket"] url = git@bitbucket.org:you/repo.git fetch = +refs/heads/*:refs/remotes/bitbucket/* $ git push bitbucket //edit after tinco's comment +refs/heads/:refs/remotes/origin/ -> +refs/heads/:refs/remotes/bitbucket/
- zemanel 14y agoAh but i meant a global service for public repos, instead of each owner setting up manually
- 1SaltwaterC 14y agoA remote can have multiple url entries. 'git push origin master' in my case pushes to Bitbucket, then GitHub. Must be manually added through 'git config -e' though. The order is important as it pulls from the first remote URL, while the push is to all.
- zemanel 14y agoi understood that and was aware. What i mean was for a web service that would monitor changes on public repos (commits, tags, branches) and would sync them automatically (mapping accounts, pruning branches, etc).
- kh_hk 14y agoWhat would happen if that service goes down?
- zemanel 14y ago:-) the original and mirror repos would still be available, even if the mirrors would be outdated since the mirror service failure ?
- kh_hk 14y agoI know this is just speculative, and in fact I was joking, but to achieve that you either have to: 1) Configure a push hook on the master server, which you need access to. 2) Remove decentralized from DVCS, as your service becomes a new master which then mirrors. 3) Continuously poll (pull) the master server from your mirror service. I can't seem to find any of these three options more desirable than simply adding a new remote, other than being automatic.
- zemanel 14y agoYes :-) plus the bandwidth and storage would be overkill overtime
- tinco 14y agoThat snippet overrides your remotes/origin branch with what you pull from bitbucket. This might not be what you want. Instead you probably should do: fetch = +refs/heads/*:refs/remotes/bitbucket/* Unless you really know what you're doing and are just crazy like that :)
- zalew 14y agoI thought he thinks of a push and forget backup, so I didn't care. but yea, you're right.