Setting up Git
Context
In order to work locally on the repositories and their content hosted at the ASAM GitLab, users can install and set up Git on their local computer. Git can also interface directly with VSCode, making changing and updating files from within one tool an easy option.
How
Git requires a multi-step installation. The following sections describe each part of this setup sequentially.
Install Git
-
If you are unsure if git is installed, you can check by entering the following in a shell window and confirming:
git --version
If a git version is returned, git is already installed on your system.
-
If git is not installed, follow the instructions on how to install git
Configure user credentials
After installation of Git, configure your user credentials that Git uses when checking in changed content from your PC to the ASAM GitLab. To make sure your commits match your name and email details, a one time configuration is necessary.
-
Open a shell or terminal window
-
Execute the following command and replace the entries "FIRST_NAME, LAST_NAME" accordingly:
git config --global user.name "FIRST_NAME LAST_NAME"
Example 1. Setting git user name for Max Mustermanngit config --global user.name Max Mustermann
-
Next, execute the following command and replace the entry "MY_NAME@example.com" with your comany’s email:
git config --global user.email "MY_NAME@example.com"
Example 2. Setting email for Max Mustermann working at companygit config --global user.email max.mustermann@company.com
If no error is returned, the configuration step has been successful.
OPTIONAL: SSH Key Pair
To ensure you don’t have to enter your login details every time you want to interact with the repository, add an SSH key to your account.
-
Generate an SSH key pair following the official instructions.
Entering a passphrase is optional and leads to additional steps every time you connect to the remote, so it is not recommended. -
Add the generated SSH public key to your GitLab account by following these instructions.
Troubleshooting / Known Issues
I cannot click Next after selecting 'Visual Studio Code' as Git’s default editor during installation
If you cannot click Next, make sure Visual Studio Code is already installed. Return to the previous step and continue again. Now, the Next button should be active.
My SSH keys are not working
Make sure that the ssh-agent is running:
-
Open a shell or terminal window
-
Type the following command, hit Enter, and check the status:
Get-Service ssh-agent
-
If the status is "Stopped", type the following, hit Enter, and check the StartType.
Get-Service ssh-agent | Select StartType
-
If the StartType is "Disabled", activate the SSH Agent. See My SSH agent is deactivated.
Continue here after your SSH agent has bee activated.
-
-
Enter the following command and hit Enter
Start-Service ssh-agent
My SSH agent is deactivated
This requires administration rights. If you do not have these, request support from your IT department. |
-
Open a shell or terminal window with Administration rights
-
Set the SSH Agent to start manually by typing the following command and hitting Enter:
Get-Service -Name ssh-agent | Set-Service -StartupType Manual