...
 
Commits (7)
#### **NOTE** - Replace xgitlab.cels.anl.gov with gitlab.cels.anl.gov in the examples if you are working with gitlab.cels.anl.gov.
## Contents of this Repository
* README.md - This README / Quick Start Guide
......@@ -13,24 +11,59 @@ More information about branching, forking, rebasing, merging and all that good s
### Getting Started with GitLab
Once you have an account on a GitLab server, you will want to set up your SSH key so that you can clone and contribute to projects hosted there.
**Note:** The examples below reference `xgitlab`; replace `xgitlab` with `gitlab` when working with `gitlab.cels.anl.gov`
1. Generate an SSH keypair for GitLab (optional)
* `ssh-keygen -t rsa -b 2048 -f ~/.ssh/xgitlab.cels.anl.gov`
You can use an existing keypair (e.g. `id_rsa` / `id_rsa.pub`) if you prefer, but it is generally a good idea to have unique keys for distinct services. If you already have a keypair you would like to use, skip this step.
```
ssh-keygen -t rsa -b 2048 -f ~/.ssh/xgitlab.cels.anl.gov
```
**Note:** This command will generate 2 files; `~/.ssh/xgitlab.cels.anl.gov.pub` (your public key) and `~/.ssh/xgitlab.cels.anl.gov` (your private key).
1. Add your SSH public key to your account on GitLab:
1. Browse to: https://xgitlab.cels.anl.gov/profile/keys
1. Click Add SSH Key (top-right)
1. Set the title to something meaningful
1. Copy your public key and paste it into the Key field
1. Click Add Key
In order to authenticate your user with GitLab, you will need to provide the public portion of the keypair you wish to use to the GitLab service.
1. Browse to: https://xgitlab.cels.anl.gov/profile/keys
1. Copy your **public** key (the filename ends with `.pub`) to your clipboard
1. Paste your public key into the "Key" field
1. Set the "Title" to something meaningful
1. Click "Add Key"
1. Add an entry for GitLab in your ~/.ssh/config file (Optional but very convenient)
* This will allow you to type something like `git clone xgitlab:namespace/project.git` without needing to pass a username, fqdn, or ssh identity to git
`~/.ssh/config` is your user's configuration file that is used by the ssh client. You can set the specific SSH options to use for new connections by adding an entry to the file, like below:
```
Host xgitlab
User git
Hostname xgitlab.cels.anl.gov
IdentityFile ~/.ssh/xgitlab.cels.anl.gov
```
Without the above entry in your SSH config, to clone a project, you might have to type:
```
GIT_SSH_COMMAND='ssh -i ~/.ssh/xgitlab.cels.anl.gov' git clone git@xgitlab.cels.anl.gov:cpbills/git-tips.git
```
But with the above entry in your SSH config, you can clone the project by typing:
```
git clone xgitlab:cpbills/git-tips.git
```
### Setting the git author
Setting a user and email for git to add to a commit will let people know who is making the commits. Use the example below to set your name and email:
```
Host xgitlab
User git
Hostname xgitlab.cels.anl.gov
IdentityFile ~/.ssh/xgitlab.cels.anl.gov
git config --global user.name "John Smith"
git config --global user.email "jsmith@anl.gov"
```
### Cloning a Repository
......@@ -224,3 +257,8 @@ As with everything else, if you have additions, fixes or updates, you are encour
#### Usage
Copy the aliases from `git-aliases` that you want to use into `~/.gitconfig`
### Push Notifications
Gitlab does not natively implement push notifications on repositories. You can set your preferences on what you'd like to be notified about following [these docs](https://docs.gitlab.com/ce/workflow/notifications.html) but you'll find "push" is not included.
To be included on push notifications, the project owner needs to specifically enable it and add your e-mail to the list. This can be done via https://xgitlab.cels.anl.gov/<path-to-repo>/services/emails_on_push/edit by anyone with admin rights on the project. If you do not have those rights, ask the project owner to do so for you.