Paul Martin
2016-04-30 a502d96a860456ec5e8c96761db70f7cabb74751
commit | author | age
85c2e6 1 ## Gitblit Configuration
dd7961 2
JM 3 ### Administering Repositories
00afd7 4 Repositories can be created, edited, renamed, and deleted through the web UI.  They may also be created, edited, and deleted from the command-line using real [Git](http://git-scm.com) or your favorite file manager and text editor.
dd7961 5
JM 6 All repository settings are stored within the repository `.git/config` file under the *gitblit* section.
7
8     [gitblit]
9         description = master repository
00afd7 10         owner = james
dd7961 11         useTickets = false
JM 12         useDocs = true
13         showRemoteBranches = false
14         accessRestriction = clone
00afd7 15         isFrozen = false
a1ea87 16         showReadme = false
f6740d 17         federationStrategy = FEDERATE_THIS
831469 18         isFederated = false
84c1d5 19         skipSizeCalculation = false
8f73a7 20         federationSets = 
3b5289 21
dd7961 22 #### Repository Names
46bfcc 23 Repository names must be case-insensitive-unique but are CASE-SENSITIVE ON CASE-SENSITIVE FILESYSTEMS.  The name must be composed of letters, digits, or `/ _ - . ~ +`<br/>
dd7961 24 Whitespace is illegal.
JM 25
168566 26 Repositories can be grouped within subfolders.  e.g. *libraries/mycoollib.git* and *libraries/myotherlib.git*
a3bde6 27
85c2e6 28 All repositories created with Gitblit are *bare* and will automatically have *.git* appended to the name at creation time, if not already specified. 
a3bde6 29
00afd7 30 #### Repository Owner
JM 31 The *Repository Owner* has the special permission of being able to edit a repository through the web UI.  The Repository Owner is not permitted to rename the repository, delete the repository, or reassign ownership to another user.
32
20714a 33 ### Access Restrictions and Access Permissions
JM 34 ![permissions matrix](permissions_matrix.png "Permissions and Restrictions")
35
36 #### Discrete Permissions (Gitblit v1.2.0+)
37
38 Since v1.2.0, Gitblit supports more discrete permissions.  While Gitblit does not offer a built-in solution for branch-based permissions like Gitolite, it does allow for the following repository access permissions:
39
40 - **V** (view in web ui, RSS feeds, download zip)
41 - **R** (clone)
42 - **RW** (clone and push)
43 - **RWC** (clone and push with ref creation)
44 - **RWD** (clone and push with ref creation, deletion)
45 - **RW+** (clone and push with ref creation, deletion, rewind)
5d7545 46
JM 47 These permission codes are combined with the repository path to create a user permission:
48
49     RW:mygroup/myrepo.git
50
cc0477 51 **NOTE:**  
JM 52 The following repository permissions are equivalent:
53
54 - myrepo.git
55 - RW+:myrepo.git
56
57 This is to preserve backwards-compatibility with Gitblit <= 1.1.0 which granted rewind power to all access-permitted users.
58
5d7545 59 #### Discrete Permissions with Regex Matching (Gitblit v1.2.0+)
JM 60
e5aaa5 61 Gitblit also supports *case-insensitive* regex matching for repository permissions.  The following permission grants push privileges to all repositories in the *mygroup* folder.
5d7545 62
2d48e2 63     RW:mygroup/.*
JM 64
65 ##### Exclusions
66
67 When using regex matching it may also be useful to exclude specific repositories or to exclude regex repository matches.  You may specify the **X** permission for exclusion.  The following example grants clone permission to all repositories except the repositories in mygroup.  The user/team will have no access whatsoever to these repositories.
68
69     X:mygroup/.*
70     R:.*
71
72 ##### Order is Important
73
74 The preceding example should suggest that order of permissions is important with regex matching.  Here are the rules for determining the permission that is applied to a repository request:
75
76 1. If the user is an admin or repository owner, then RW+
77 2. Else if user has an explicit permission, use that
78 3. Else check for the first regex match in user permissions
79 4. Else check for the HIGHEST permission from team memberships
80     1. If the team is an admin team, then RW+
81     2. Else if a team has an explicit permission, use that
82     3. Else check for the first regex match in team permissions
20714a 83
724da5 84 #### No-So-Discrete Permissions (Gitblit &lt;= v1.1.0)
20714a 85
15640f 86 Prior to v1.2.0, Gitblit has two main access permission groupings:  
JM 87
88 1. what you are permitted to do as an anonymous user
89 2. **RW+** for any permitted user
90
91 #### Committer Verification
92
93 You may optionally enable committer verification which requires that each commit be committed by the authenticated user pushing the commits.  i.e. If Bob is pushing the commits, Bob **must** be the committer of those commits.
94
95 **How is this enforced?**
96
f19b78 97 Bob must properly set his *user.name* and *user.email* values for the repository to match his Gitblit user account **BEFORE** committing to his repository.
6c4be1 98
JM 99 ```
15640f 100 [user "bob"]
JM 101     displayName = Bob Jones
102     emailAddress = bob@somewhere.com
6c4be1 103 ```
JM 104
15640f 105     git config user.name "Bob Jones"
JM 106     git config user.email bob@somewhere.com    
107 or
108
109     git config user.name bob
110     git config user.email bob@somewhere.com    
111
f19b78 112 The committer email address is required to be identical.  Display name or username can be used as the committer name.
15640f 113
JM 114 All checks are case-insensitive.
115
116 **What about merges?**
117
8c99a7 118 You can not use fast-forward merges on your client when using committer verification.  You must specify *--no-ff* to ensure that a merge commit is created with your identity as the committer.  Only the first/left parent chain is traversed when verifying commits.
20714a 119
8c99a7 120 #### Reflog
93d506 121
da97a6 122 Gitblit v1.2.1 introduced an incomplete reflog mechanism which was completed in 1.3.0.  All pushes to Gitblit are automatically logged on an orphan branch, `refs/meta/gitblit/reflog`.  If this ref exists, the reflog page link will be displayed on the repository pages.
8c99a7 123
JM 124 This reflog is similar to, but not the same as, the normal Git reflog. The Gitblit reflog links Gitblit accounts to ref changes and because it is stored on an orphan branch, the reflog is portable by the federation mechanism or by a normal <code>git clone --mirror</code> command.
93d506 125
fe24a0 126 ### Teams
JM 127
8c99a7 128 Teams have assigned users and assigned repositories.  A user can be a member of multiple teams and a repository may belong to multiple teams.  This allows the administrator to quickly add a user to a team without having to keep track of all the appropriate repositories. 
fe24a0 129
8c99a7 130 ### Administering Users
JM 131 All users and permissions are stored in the `users.conf` file. Your file extension must be *.conf* in order to use this user service.
fe24a0 132
93f472 133 The `users.conf` file uses a Git-style configuration format:
JM 134
135     [user "admin"]
136         password = admin
137         role = "#admin"
138         role = "#notfederated"
20714a 139         repository = RW+:repo1.git
JM 140         repository = RW+:repo2.git
fe24a0 141         
JM 142     [user "hannibal"]
143         password = bossman
20714a 144         repository = RWD:topsecret.git
5d7545 145         repository = RW+:ateam/[A-Za-z0-9-~_\\./]+
fe24a0 146
JM 147     [user "faceman"]
148         password = vanity
149
150     [user "murdock"]
151         password = crazy        
152         
153     [user "babaracus"]
154         password = grrrr
155         
156     [team "ateam"]
157         user = hannibal
158         user = faceman
159         user = murdock
160         user = babaracus
20714a 161         repository = RW:topsecret.git
0b9119 162         mailingList = list@ateam.org
d7905a 163         postReceiveScript = sendmail
93f472 164
8c99a7 165 The `users.conf` file allows flexibility for adding new fields to a UserModel object without imposing the complexity of relying on an embedded SQL database. 
dd7961 166
20714a 167 ### Usernames
3b5289 168 Usernames must be unique and are case-insensitive.  
dd7961 169 Whitespace is illegal.
JM 170
20714a 171 ### Passwords
486ee1 172 User passwords are CASE-SENSITIVE and may be *plain*, *md5*, or *combined-md5* formatted (see `gitblit.properties` -> *realm.passwordStorage*).
dd7961 173
20714a 174 ### User Roles
JM 175 There are four actual *roles* in Gitblit:
176
8c99a7 177 - *#admin*, which grants administrative powers to that user for all repositories, users, and teams
20714a 178 - *#notfederated*, which prevents an account from being pulled by another Gitblit instance
JM 179 - *#create*, which allows the user the power to create personal repositories
180 - *#fork*, which allows the user to create a personal fork of an existing Gitblit-hosted repository
181
182 ### Personal Repositories & Forks
183
184 Personal Repositories and Forks are related but are controlled individually.
185
186 #### Creating a Personal Repository
187 A user may be granted the power to create personal repositories by specifying the *#create* role through the web ui or through the RPC mechanism via the Gitblit Manager.  Personal repositories are exactly like common/shared repositories except that the owner has a few additional administrative powers for that repository, like rename and delete.
188
189 #### Creating a Fork
190 A user may also be granted the power to fork an existing repository hosted on your Gitblit server to their own personal clone by specifying the *#fork* role through the web ui or via the Gitblit Manager.
191
192 Forks are mostly likely personal repositories or common/shared repositories except for two important differences:
193
194 1. Forks inherit a view/clone access list from the origin repository.  
195 i.e. if Team A has clone access to the origin repository, then by default Team A also has clone access to the fork.  This is to facilitate collaboration.
196 2. Forks are always listed in the fork network, regardless of any access restriction set on the fork.  
197 In other words, if you fork *RepoA.git* to *~me/RepoA.git* and then set the access restriction of *~me/RepoA.git* to *Authenticated View, Clone, & Push* your fork will still be listed in the fork network for *RepoA.git*.
198
199 If you really must have an invisible fork, the clone it locally, create a new personal repository for your invisible fork, and push it back to that personal repository.
073b11 200