1. Add your SSH public key to your account on GitLab:
1. Browse to: https://gitlab.cels.anl.gov/profile/keys
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
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 gitlab:namespace/project.git` without needing to pass a username, fqdn, or ssh identity to git
* 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
```
Host gitlab
Host xgitlab
User git
Hostname gitlab.cels.anl.gov
IdentityFile ~/.ssh/gitlab.cels.anl.gov
Hostname xgitlab.cels.anl.gov
IdentityFile ~/.ssh/xgitlab.cels.anl.gov
```
### Cloning a Repository
Once you've set up SSH, cloning a repository hosted on GitLab is pretty simple and straightforward. The structure of a repository's URI is: <host>:<namespace>/<project>.git (example: gitlab:systems/git-tips.git). Determine where you want to clone the repository; a directory like ~/projects/ works pretty well, but it really doesn't matter; wherever you are most comfortable working.
Once you've set up SSH, cloning a repository hosted on GitLab is pretty simple and straightforward. The structure of a repository's URI is: <host>:<namespace>/<project>.git (example: xgitlab:systems/git-tips.git). Determine where you want to clone the repository; a directory like ~/projects/ works pretty well, but it really doesn't matter; wherever you are most comfortable working.
* Change to your projects directory (e.g. `cd ~/projects`)
*`git clone -o systems gitlab:systems/git-tips.git`
*`git clone -o systems xgitlab:systems/git-tips.git`
That's it.
...
...
@@ -99,15 +99,15 @@ The fork-style workflow is useful when there are numerous contributors managing
Forking a repository on GitLab:
* Browse to https://gitlab.cels.anl.gov/systems/git-tips.git
* Browse to https://xgitlab.cels.anl.gov/systems/git-tips.git
* Click the button in the top right that says 'Fork'
* Select the namespace you want to create the fork in
Getting set up with your fork and multiple remotes:
```
git clone -o foo gitlab:foo/git-tips.git # Clone your fork
git remote add systems gitlab:systems/git-tips.git # Add the 'systems' remote
git clone -o foo xgitlab:foo/git-tips.git # Clone your fork
git remote add systems xgitlab:systems/git-tips.git # Add the 'systems' remote
```
You now have two remotes; 'foo' and 'systems'. You can push or pull code using either of them:
...
...
@@ -129,7 +129,7 @@ Whether using the fork or branch workflows, contributing changes to a project (a
When all is said and done, and you have work that is ready to be reviewed by others and potentially pushed to 'production', you will need to create a Merge Request on GitLab:
* Browse to the project's page on GitLab (e.g. https://gitlab.cels.anl.gov/systems/git-tips.git) OR your forked repository's page
* Browse to the project's page on GitLab (e.g. https://xgitlab.cels.anl.gov/systems/git-tips.git) OR your forked repository's page
* Locate and click '+ New Merge Request' near the top right of the page (Subject to change as GitLab evolves)
* Select your source project and branch (e.g. systems/git-tips and 'foo', or username/git-tips and 'foo')
* Select your target project and branch (e.g. systems/project and 'prod')
...
...
@@ -167,7 +167,7 @@ for branch in $(git branch -r | grep source | grep -v HEAD); do
done
# Where 'namespace' is the user/group, and 'project' is the name of the project on GitLab: