git init --bare
git
Usage
git init --bare [--shared=group] <directory>.gitCreates a repository with no working tree, meant only to be pushed to; you cannot edit files in it, but pushes never bounce off a checked-out branch.
Common flags
| Flag | Meaning |
|---|---|
| --bare | no working tree; only the contents of .git |
| --shared=group | let one unix group push into it |
| -b <name> | name the first branch |
| --template=<dir> | seed it with hooks from a template directory |
Examples
git init --bare /srv/git/app.gitcreates a repository to push into over ssh
git init --bare --shared=group team.gita shared repository a unix group can all write to
git init --bare ~/backup/app.gita push target on a backup disk
The confusion is that undo has several shapes — moving where a branch points is not the same as adding a commit that reverses it.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does git init --bare do?
Creates a repository with no working tree, meant only to be pushed to; you cannot edit files in it, but pushes never bounce off a checked-out branch.
Q. How do I type it?
git init --bare [--shared=group] <directory>.git — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
4 are listed here; the full set is in man git. This command sits under git.
Related commands
man page: man git-init---bare