Cloning IT Common Platform Code with glab#
Within the IT Common Platform, we utilize the glab CLI tool to clone our entire codebase to local computers. glab is a powerful command-line interface that provides a seamless experience for managing GitLab repositories.
Installation#
To get started with glab, you'll first need to install it on your local machine. Assuming you're using a Mac, you can install glab using Homebrew:
Authentication#
Before you can use glab to clone repositories, you'll need to authenticate with the GitLab instance hosted at https://code.vt.edu. You can do this by setting the following environment variables:
Replace <your_gitlab_token> with your personal GitLab access token. You can generate a new token by following these steps:
- Log in to the GitLab web interface.
- Click on your profile icon in the top-right corner and select "Settings".
- In the left-hand menu, select "Access Tokens".
- Fill out the form, providing a name for the token and selecting the appropriate scopes (e.g.,
api,read_user,write_repository). - Click "Create personal access token" to generate your token.
Cloning the IT Common Platform Codebase#
Once you've set the necessary environment variables, you can use glab to clone the entire IT Common Platform codebase to your local machine. To do this, run the following commands:
GITLAB_TOKEN="$(cat /tmp/token)" GITLAB_HOST='https://code.vt.edu' glab repo clone --paginate -a=false -p -g 3351
The first command clones the repository using the GITLAB_TOKEN and GITLAB_HOST environment variables you set earlier. The second command is an alternative method that reads the token from a temporary file /tmp/token.
Additional Resources#
For more information on using glab and GitLab workflows, please refer to the following resources: