GitLab is the number 2 hosting provider for Git repos after GitHub
It has good feature parity with GitHub.com, although less 3rd party CI/CD integrations as everybody integrates to GitHub first .
- GitLab CLI
- GitLab CLI and API auth
- Git Clone over HTTPS using API Token
- GitLab CI/CD
- GitLab Official CI/CD Library
- GitLab Profile Page
On Mac using Homebrew:
brew install glabglab --helpVarious GitLab CLI scripts are in HariSekhon/DevOps-Bash-tools repo.
Script to download latest binary from GitLab to /usr/local/bin or $HOME/bin:
git clone https://github.com/HariSekhon/DevOps-Bash-tools bash-tools
cd bash-toolsinstall/install_gitlab_cli.shFor the glab CLI above and the gitlab_api.sh script in the
DevOps-Bash-tools repo, create a Personal Access Token here:
GitLab -> Preferences -> Access Tokens
The add this to your shell / Bash profile:
export GITLAB_TOKEN=...Gitlab CLI config can be found here:
~/.config/glab-cli/config.yml
Cloning with HTTPS then becomes:
git clone "https://GITLAB_TOKEN@gitlab.com/$ORG/$REPO.git"or better using a credential helper...
Taken from my .gitconfig:
[credential "https://gitlab.com"]
helper = "!f() { sleep 1; echo \"password=${GITLAB_TOKEN}\"; }; f"git clone "https://gitlab.com/$ORG/$REPO.git"If you get a 401 or 403 authentication or authorization error, you can check Git debug output by setting:
export GIT_CURL_VERBOSE=1Create a .gitlab-ci.yml into the root directory of your git repo, then git push to GitLab.
Template to get you started:
See adjacent GitHub Profile Page doc.
Partial port from private Knowledge Base page 2012+