简体   繁体   中英

How to backup a local bare git repository to remote git repository

We created a bare git repository on our own server, and we want to back it up on a remote server like bitbucket.

What's the best way to do this?

Our solution is to use an update hook after each push, but we're not sure whether this solution covers all kind of changes to the repository.

----- Edit:

Sorry, maybe I didn't describe it clearly. My problem is how to automatically backup a bare git (created by "git init --bare") repository to a remote git repository(when something changed). Not one time back up. And we expect the backup looks like a real time mirror of our own bare git repository.

Finally, I found the solution:

git remote add --mirror=push <name> <address>

Triggered in post-receive hook.

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