This repository contains an automated installation script for GitLab CLI (glab) with dependency management and post-installation verification.
# Make the script executable
chmod +x install-glab.sh
# Install the latest version
./install-glab.sh
# Install a specific version
./install-glab.sh 1.61.0- Auto-detection of the latest available version
- Version checking of currently installed version
- Automatic installation of missing dependencies
- Clean installation with automatic cleanup of temporary files
- Robust JSON parsing with jq for GitLab API
- Post-installation verification of proper functionality
- Robust error handling with colored messages
The script automatically manages the installation of the following dependencies:
wget- For downloading packagesdpkg- For installing .deb packagesjq- For parsing JSON responses from GitLab APIgit- Required for all Git functionality in glabssh- For SSH authentication with GitLabgpg- For signature verification (recommended for security)
Note: If any dependencies are missing, the script will automatically install them via
apt-get. Administrator privileges required.
After installation, start by authenticating:
# Authentication with GitLab.com
glab auth login
# Or with a custom GitLab instance
glab auth login --hostname gitlab.example.comThe script automatically verifies that glab works correctly after installation.
For detailed usage instructions and command reference, please refer to the official glab documentation.
# Update to the latest version
./install-glab.sh
# Install a specific version
./install-glab.sh 1.62.0
# Display help to see all options
./install-glab.sh --helpThe script automatically checks currently installed version, missing dependencies, and proper functionality after update.
To completely remove glab from your system:
# Uninstall glab
./install-glab.sh --uninstallThe uninstallation process will:
- Remove the glab package from your system
- Optionally delete configuration files (
~/.config/glab-cli/)
Note: You will be prompted whether to keep or delete your configuration files during uninstallation.
Error:
ERROR: none of the git remotes configured for this repository point to a known GitLab host.
Solution:
- Check your remotes:
git remote -v - Ensure the remote domain matches your glab configuration
- Use
glab auth login --hostname your-gitlab-domain.comto configure the correct host
Cause: The configured port does not respond with HTTPS/TLS.
Solution:
- Verify the correct domain for the web API
- Test connectivity:
curl -I https://your-gitlab-domain.com - Use the correct domain in
glab auth login
Cause: Network connectivity issue or closed port.
Solution:
- Check your network connection
- Test connectivity with curl
- Check corporate firewalls/proxies
# View current configuration
glab config get
# View configured hosts
cat ~/.config/glab-cli/config.yml
# Test connection
glab api projectsIf you encounter issues, verify that all dependencies are installed:
# Check for essential tools
command -v wget && echo "[OK] wget installed" || echo "[MISSING] wget missing"
command -v git && echo "[OK] git installed" || echo "[MISSING] git missing"
command -v ssh && echo "[OK] ssh installed" || echo "[MISSING] ssh missing"
command -v jq && echo "[OK] jq installed" || echo "[MISSING] jq missing"
command -v gpg && echo "[OK] gpg installed" || echo "[MISSING] gpg missing"
# Re-run the script to install missing dependencies
./install-glab.sh --help # Shows help and dependency list- Automatic Installation: The script automatically installs all necessary dependencies
- Personal Tokens: Keep your tokens secure and never commit them
- Permissions: Ensure your tokens have
apiandwrite_repositoryscopes - Administrator Privileges: Required for automatic dependency installation
- Enterprise Environments: Configurations may vary based on your infrastructure
- Backup: Always backup your configuration before making changes
- Post-installation Verification: The script automatically tests glab functionality
If you encounter issues specific to your environment or have improvements to suggest for the script, feel free to contribute!