问题
I want to use GIT as a Backup solution. I have a windows shared network in my Company and a Centos Server. Each user have a unique shared folder, where is located all files of user. We have 2 developers, they can have a git repo(s).
How Can I make the entire folder of user a GIT repo, a perform usual git operations, commit, push, etc, without import if subfolders have git repos?
Note: Submodules is not a solution, I don't know what repositories is under the main folder of user.
回答1:
There are a number of reasons why Git does not make a good backup solution:
- you cannot have nested Git repositories -- there is no way to coerce Git to treat a nested
.git
directory like a normal directory - it doesn't save complete permissions and ownership
- its index format does not scale to many files
- it does not handle large files well (it runs out of memory because it needs to put the entire file in memory to compress -- or at least that was true about a year ago, maybe they've fixed it)
- while the compression is good for source code, it's not very good for virtual machine images, etc.
- backing up to a remote system involves backing up locally first
- no defense against backup file corruption
That being said, there are some reasons why Git would be awesome as a backup solution:
- every backup is a complete snapshot -- you don't need to restore an old full backup followed by some number of incremental backups in order to get the latest files
- ridiculously good deduplication performance
- good space efficiency in general
- great support for efficiently transferring backups to remote systems
My recommendation: take a look at bup. It's not very mature, it's not seeing much active development, and it lacks some important features, but it has a lot of promise. It's an open source backup program based on Git. They've kept the things Git does well, but replaced/augmented some of the things Git does poorly (for backups).
回答2:
All you have to do is
git init
at the base of each users. If they are storing their git repos there, the scope of git will stop at those directories that have a .git
folder.
It's not clear if what you want to do is to commit the git repos to another git repo. I would not recommend doing this.
来源:https://stackoverflow.com/questions/11269804/nested-and-independent-git-repos-for-backup-how