Setting up Git and GitLab_ CSE252 A
Setting up Git and GitLab_ CSE252 A
Setting up Git and GitLab_ CSE252 A
There are a several reasons why we introduce version control in this course, even though it is
usually reserved for complex projects or professional practice:
I often get questions related to breakages in a previously working program. If I can see the
history of the change you made, I can quickly find the culprit.
When submitting to GitLab, GitLab can kick off tests checking for common errors or test that
you've met the requirements of the assignment.
It is an easy way to distribute starting files without having to download single files at a time or
use zip files
On group projects, I've found that students have difficulty sharing code and the codebase
quickly gets of sync between the group members. By having a central repository for the code,
it is easier to keep group projects in sync.
Install Git
MacOS
Step 1 - Install Homebrew
Copy and paste the following into the terminal window and hit return
You will be offered to install the Command Line Developer Tools from Apple. Confirm by
clicking Install. After the installation finished, continue
installing Homebrew by hitting Return again.
Copy and paste the following into the terminal window and press Return or Enter.
Windows
Download and install git for Windows (https://git-scm.com/downloads) . Once installed, you
will launch the Git Bash program to continue the instructions.
ssh-keygen
When asked to enter a file name in which to save the key just press Return or Enter.
When asked to enter a passphrase, enter a passphrase (note that you will not see your
password/asterisks echo to the screen). This is used to encrypt your private key. Remember it,
as if you forget it, you will have to generate a new key.
Now, you need to upload your public key to GitLab. First, get the key into your clipboard by typing:
In a Terminal (MacOS) or Git Bash (Windows), copy/paste the following (note that if you type it,
those are backticks `, not single quotes ' ):
1. git config --global user.name "YOUR NAME" , replacing YOUR NAME with your name
2. git config --global user.email [email protected] , replacing [email protected] with your e-
mail address.
3. git config --global push.default simple
First, make sure you can run VS Code from the command line:
code --help
You should get some output about the Visual Studio Code version. If that doesn't work and you
are using MacOS, then in VS Code, do View, Command Palette and select "Shell Command:
Install 'Code' command in path".
Once code can be launched from the command line, configure git to use it with this command: