Skip to content

Commit d1847cc

Browse files
committed
Merge pull request #25 from schacon/gitlab
Gitlab
2 parents 3c7c397 + 9b73763 commit d1847cc

File tree

6 files changed

+136
-0
lines changed

6 files changed

+136
-0
lines changed

en/book/04-git-server/chapter4.asc

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,142 @@ We'll round off this discussion with a sampling of other features, all of which,
600600

601601
=== GitLab
602602

603+
If you're working on a team, often you need more than source code hosting.
604+
GitLab is one package that offers project structure, issue tracking, chat, wikis, and collaboration with unprivileged users, in addition to ``just'' git hosting.
605+
606+
==== Flavors
607+
608+
GitLab is a fully open-source project (the project page can be found at http://www.gitlab.org[]), which is developed and supported by a for-profit company (found at http://www.gitlab.com[]).
609+
There are several options for obtaining and using GitLab:
610+
611+
1. The Community Edition is the basic product, and is offered free of charge.
612+
You install the software on your machine, and you're responsible for configuring and updating it.
613+
2. The Enterprise Edition extends the Community Edition with some extra features, and is available through a subscription plan.
614+
Your subscription fees pay for installation and configuration support, ongoing technical support, and continued GitLab development.
615+
3. GitLab Cloud is an installation of the Community Edition running on GitLab's servers.
616+
There's no charge for the service, and very few limits on how you use it.
617+
This is a great way to take GitLab for a spin before expending effort configuring your own server.
618+
619+
620+
==== Installation
621+
622+
GitLab is a database-backed web application, so its installation is a bit more involved than some other git servers.
623+
Fortunately, this process is very well-documented and supported.
624+
625+
There are a few methods you can pursue to install GitLab.
626+
To get something up and running quickly, you can download a virtual machine image or a one-click installer from https://bitnami.com/stack/gitlab[], and tweak the configuration to match your particular environment.
627+
One nice touch Bitnami has included is the login screen (accessed by typing alt-→); it tells you the IP address and default username and password for the installed GitLab.
628+
629+
[[bitnami]]
630+
.The Bitnami GitLab virtual machine login screen.
631+
image::images/bitnami.png[The Bitnami GitLab virtual machine login screen.]
632+
633+
For anything else, follow the guidance in the GitLab Community Edition readme, which can be found at https://gitlab.com/gitlab-org/gitlab-ce/tree/master[].
634+
There you'll find assistance for installing GitLab using Chef recipes, a virtual machine on Digital Ocean, and RPM and DEB packages (which, as of this writing, are in beta).
635+
There's also ``unofficial'' guidance on getting GitLab running with non-standard operating systems and databases, a fully-manual installation script, and many other topics.
636+
637+
638+
==== Administration
639+
640+
GitLab's administration interface is accessed over the web.
641+
Simply point your browser to the hostname or IP address where GitLab is installed, and log in as an admin user.
642+
The default username is `[email protected]`, and the default password is `5iveL!fe` (which you will be prompted to change as soon as you enter it).
643+
Once logged in, click the ``Admin area'' icon in the menu at the top right.
644+
645+
[[gitlab_menu]]
646+
.The ``Admin area'' item in the GitLab menu.
647+
image::images/gitlab-menu.png[The ``Admin area'' item in the GitLab menu.]
648+
649+
===== Users
650+
651+
Users in GitLab are accounts that correspond to people.
652+
User accounts don't have a lot of complexity; mainly it's a collection of personal information attached to login data.
653+
Each user account comes with a *namespace*, which is a logical grouping of projects that belong to that user.
654+
If the user +jane+ had a project named +project+, that project's url would be http://server/jane/project[].
655+
656+
[[gitlab_users]]
657+
.The GitLab user administration screen.
658+
image::images/gitlab-users.png[The GitLab user administration screen.]
659+
660+
Removing a user can be done in two ways.
661+
``Blocking'' a user prevents them from logging into the GitLab instance, but all of the data under that user's namespace will be preserved, and commits signed with that user's email address will still link back to their profile.
662+
663+
``Destroying'' a user, on the other hand, completely removes them from the database and filesystem. All projects and data in their namespace is removed, and any groups they own will also be removed.
664+
This is obviously a much more permanent and destructive action, and its uses are rare.
665+
666+
[[_gitlab_groups_section]]
667+
===== Groups
668+
669+
A GitLab group is an assemblage of projects, along with data about how users can access those projects.
670+
Each group has a project namespace (the same way that users do), so if the group +training+ has a project +materials+, its url would be http://server/training/materials[].
671+
672+
[[gitlab_groups]]
673+
.The GitLab group administration screen.
674+
image::images/gitlab-groups.png[The GitLab group administration screen.]
675+
676+
Each group is associated with a number of users, each of which has a level of permissions for the group's projects and the group itself.
677+
These range from ``Guest'' (issues and chat only) to ``Owner'' (full control of the group, its members, and its projects).
678+
The types of permissions are too numerous to list here, but GitLab has a helpful link on the administration screen.
679+
680+
===== Projects
681+
682+
A GitLab project roughly corresponds to a single git repository.
683+
Every project belongs to a single namespace, either a user or a group.
684+
If the project belongs to a user, the owner of the project has direct control over who has access to the project; if the project belongs to a group, the group's user-level permissions will also take effect.
685+
686+
Every project also has a visibility level, which controls who has read access to that project's pages and repository.
687+
If a project is _Private_, the project's owner must explicitly grant access to specific users.
688+
An _Internal_ project is visible to any logged-in user, and a _Public_ project is visible to anyone.
689+
Note that this controls both git "fetch" access as well as access to the web UI for that project.
690+
691+
===== Hooks
692+
693+
GitLab includes support for hooks, both at a project or system level.
694+
For either of these, the GitLab server will perform an HTTP POST with some descriptive JSON whenever relevant events occur.
695+
This is a great way to connect your git repositories and GitLab instance to the rest of your development automation, such as CI servers, chat rooms, or deployment tools.
696+
697+
==== Basic Usage
698+
699+
The first thing you'll want to do with GitLab is create a new project.
700+
This is accomplished by clicking the ``+'' icon on the toolbar.
701+
You'll be asked for the project's name, which namespace it should belong to, and what its visibility level should be.
702+
Most of what you specify here isn't permanent, and can be re-adjusted later through the settings interface.
703+
Click ``Create Project'', and you're done.
704+
705+
Once the project exists, you'll probably want to connect it with a local Git repository.
706+
Each project is accessible over HTTPS or SSH, either of which can be used to configure a Git remote.
707+
The URLs are visible at the top of the project's home page.
708+
For an existing local repository, this command will create a remote named `gitlab` to the hosted location:
709+
710+
git remote add gitlab https://server/namespace/project.git
711+
712+
If you don't have a local copy of the repository, you can simply do this:
713+
714+
git clone https://server/namespace/project.git
715+
716+
The web UI provides access to several useful views of the repository itself.
717+
Each project's home page shows recent activity, and links along the top will lead you to views of the project's files and commit log.
718+
719+
==== Working Together
720+
721+
The simplest way of working together on a GitLab project is by giving another user direct push access to the git repository.
722+
You can add a user to a project by going to the ``Members'' section of that project's settings, and associating the new user with an access level (the different access levels are discussed a bit in <<_gitlab_groups_section>>).
723+
By giving a user an access level of ``Developer'' or above, that user can push commits and branches directly to the repository with impunity.
724+
725+
Another, more decoupled way of collaboration is by using merge requests.
726+
This feature enables any user that can see a project to contribute to it in a controlled way.
727+
Users with direct access can simply create a branch, push commits to it, and open a merge request from their branch back into `master` or any other branch.
728+
Users who don't have push permissions for a repository can ``fork'' it (create their own copy), push commits to _that_ copy, and open a merge request from their fork back to the main project.
729+
This model allows the owner to be in full control of what goes into the repository and when, while allowing contributions from untrusted users.
730+
731+
Merge requests and issues are the main units of long-lived discussion in GitLab.
732+
Each merge request allows a line-by-line discussion of the proposed change (which supports a lightweight kind of code review), as well as a general overall discussion thread.
733+
Both can be assigned to users, or organized into milestones.
734+
735+
This section has focused mainly on the Git-related parts of GitLab, but it's a fairly mature system, and provides many other features that can help your team work together.
736+
These include project wikis, discussion ``walls'', and system maintenance tools.
737+
One benefit to GitLab is that, once the server is set up and running, you'll rarely need to tweak a configuration file or access the server via SSH; most administration and general usage can be accomplished through the in-browser interface.
738+
603739
=== Gerrit
604740

605741
=== Other Hosting Options

en/book/images/GitLab-menu.png

10.8 KB
Loading

en/book/images/bitnami.png

16.5 KB
Loading
15.9 KB
Loading

en/book/images/gitlab-groups.png

69.2 KB
Loading

en/book/images/gitlab-users.png

58.6 KB
Loading

0 commit comments

Comments
 (0)