Getting Started
Before you start out on your 104 journey you’re going to have to complete a couple of setup steps. Make sure you read each section carefully; if you don’t, you may find yourself unable to submit assignments.
Choose Your Toolchain / Development Environment
Before proceeding with the setup steps below, you’ll need to choose a development environment for writing and testing your C++ code. We provide setup guides for three platforms. For this lab, we recommend running through the Google Cloud Shell and Editor instructions, so that you always have it as an option. Then, later, you can run through the Windows and Mac instructions if you decide you’d prefer to run your compiler toolchain locally.
Google Cloud Shell and Editor (Officially Supported - RECOMMENDED)
Google Cloud Shell is our officially supported development environment and offers several advantages:
- Zero installation - works entirely in your browser
- Pre-configured Linux environment - best matches our autograder
- Full Valgrind support - essential for memory checking
- Consistent experience - same environment for all students
- Access from anywhere - use any laptop or system
Windows (WSL)
For students who prefer developing on their own Windows laptop using Windows Subsystem for Linux (WSL).
macOS
For students with Mac laptops. Important: Valgrind does NOT work on Apple Silicon Macs (M1/M2/M3/M4). You’ll need to use AddressSanitizer instead or use Google Cloud Shell for full Valgrind support.
Register with Github
Once you have installed your desired toolchain, it is now time to create (and/or setup) your Github account.
If you have not created a Github account yet, follow the instructions in this section. If you already have a Github account and you wish to use it for this course, you can skip to the next section.
We will be using git extensively this semester for homework and labs.
GitHub is a development ecosystem based around git. In CSCI 104, we will be using Github to host our git repositories and we will take advantage of other GitHub features such as the issue tracker and wiki.
Start by visiting Github’s signup page.
You are free to choose your username; it does not necessarily need to match your USC username.
Likewise, you are welcome to any email, though we recommend your @usc.edu email. Either way, just remember which email you use as you will need it later. You will be sent an email to verify your email address.
Do that before proceeding.
If in doubt, use a GitHub account with your @usc.edu e-mail address.
- Create or have a GitHub account
Install Git
You can skip this section if you have git installed already or are using the Google CLoud Shell environment, which has git installed.
In order to actually install the git command line tools, go to the git website and follow the instructions for your operating system.
If you’re installing on MacOS, installing the Homebrew package manager should also get you there: brew.sh
Special Notes for Windows
If you are using Windows, we recommend installing git bash, which will be provided as an option in the installer. Git bash is a separate shell that provides access to git as well as other command line utilities. If you have more experience with git or other command line tools, installing git and the other unix commands directly to your CMD is a pretty convenient option.
Configuring an SSH Key
One of the main features of using a distributed version control system such as git is having a complete backup of your code and its history. Git uses the Secure Shell protocol (SSH) when contacting remote servers. To facilitate this communication, you need to generate a pair of encryption keys: one public and the other private. In this step, we will generate the set of keys required to use SSH. This will be done manually through the command line.
Important: where you run the following instructions will depend on whether you’re using GCloud, Windows, or Mac.
If you are using Gcloud, you must connect to the GCloud: https://ide.cloud.google.com, and once loaded, open a Terminal in your HOME folder (cd $HOME) and run the following commands in the VS Code terminal area.
If you’re on Windows, start WSL/Ubuntu and VSCode (code . & at the Ubuntu prompt). You can run the following commands from the Ubuntu terminal or the WSL terminal in VS Code.
If you are on Mac you can just open a Terminal.
- Open the correct terminal based on the instructions above.
Note: you will be copying and pasting several commands in this lab. You can copy/paste the following commands to the terminal. You may need to right-click in Terminal and choose Copy/Paste.
Use the following command to generate an SSH key, replacing ttrojan@usc.edu with the email associated with your Github account:
ssh-keygen -t rsa -b 2048 -C "ttrojan@usc.edu" // your email replaced
- Generate an SSH key using the email associated with your GitHub account
When prompted for a location to save the key, use whatever the default is. The path may look slightly different than the one below, but that’s fine.
Generating public/private rsa key pair.
Enter file in which to save the key (/home/username/.ssh/id_rsa):
After that, you will be prompted for a passphrase to secure your private key.
We STRONGLY recommend you do NOT generate a passphrase (because you’ll have to enter it each time you upload your code to Github) and simply hit Enter when prompted for a passphrase. If you do decide to enter a passphrase, please note that your password will not show up in terminal as you type it.
When you are done typing your password (again, it’s best to just hit enter and not use a passphrase) .
You will be prompted to verify your passphrase.
Re-enter your passphrase (or nothing if you did not set one) and press enter.
Upon success, you should receive confirmation that your key was generated. It will most likely look something like this:
Your identification has been saved in /home/username/.ssh/id_rsa.
Your public key has been saved in /home/username/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:vC+4OG2u1PIeE0OKX9jiFFHuLnkYCBSsvIW8ybD873H ttrojan@usc.edu
The key's randomart image is:
+---[RSA 2048]----+
| ++o. |
| S+.o *.* |
| +.X. o |
| 0. o + |
| ..o E . |
| .=S. . + .0 |
| .*=* ... |
|.+.=o*. .. *o* |
| .++*oo. .. |
+----[SHA256]-----+
- Save the key to the default location
Git Configuration
Note for Google Cloud Shell users: You should have already put these commands in your .customize_environment file. You can skip over this and just run git config --list to confirm the settings are already in place.
The next step is to configure your git profile in your development environment. This is important because your profile information is used to annotate your contributions to a repository/project. It may not seem like a big deal when you are the only one committing to a repository. However, it’s a good habit to build since in a group setting, this information will help track what changes you made and how much you’ve contributed.
You only need to do this configuration once for any machine or virtual machine you want to develop on. We’ll be setting the following fields:
- Full name
- Email associated with GitHub
- Editor for commit messages, e.g.
nano,vi,emacs,notepad - Git message colors (make it prettier)
- Newline handling (why is this a problem?)
To get started, have a terminal open.
Personal Information
Please use your actual first and last name when configuring your git user.name.
For your email, you should use the email address you’ve associated with your Github account.
Configure your information as follows, replacing the example name and email with your own:
git config --global user.name "Tommy Trojan"
git config --global user.email "ttrojan@usc.edu"
-
Configure your
user.nameanduser.email
Git CLI
By default, git does not color its output. Pretty printing git messages makes it easy read the output and take proper actions. You can enable colors for interactive use with:
git config --global color.ui auto
Git Editor
When committing code in git, the system requires a commit message. If a message is not provided via the shell, git will launch the operating system’s default text editor prompting you for a message. You can customize this action by setting what command you want to invoke to open a text editor, for example:
-
nanois a simple and easy-to-use shell text editor -
emacs,vi, andvimhave a steeper learning curve but offer more utility
Choose one of them (nano is likely the easiest) and run the following command:
git config --global core.editor "nano"
- Set your git editor to the text editor command of your choice
Default branch name
Recently GitHub has changed to main as the default branch. We need our local git command to respect that:
git config --global init.defaultBranch main
Miscellaneous Settings
Operating systems implement new lines differently. Here you will configure git to automatically normalize the line feed to properly match the platform:
git config --global core.autocrlf input
-
Set the line feed normalization to
input
Since Git 2.0, Git has updated its default push settings. To avoid getting a warning when you push (we will explain what push means soon), apply the following setting:
git config --global push.default simple
-
Set the push strategy to
simple
Confirm Your Settings
You can double check your settings using the following command:
git config --list
- Check that all settings have been set properly
Github Profile
You need to update your profile to include your name and SSH public key. There are also some optional settings you can change such as your profile picture and email notifications.
In your profile settings:
- Put your real name in the name field. This is to ensure the TAs & CPs know who you are regardless of your username.
- Optionally, change your profile image
In your SSH key settings:
- Click
Add SSH Key. - Provide a name for the key, such as “CS104 Key” or “MacBook Key”.
- Display the contents of your
id_rsa.pubfile by runningcat ~/.ssh/id_rsa.pubin your terminal. - Select all the contents of your
id_rsa.pubfile all the way through the end of the last line where your email is displayed and then copy/paste them into the key field. Make sure you copy the entire contents of theid_rsa.pubfile. It should start withssh-rsaand end with your email address. - Click
Add Key.
In your notification settings, apply the following settings:
- In your notification settings
- Watching: Email OFF, Github ON
- Participating: Email ON, Web ON
- In your Customize Email Updates :
- Pull Request reviews: ON
- Pull Request pushes: ON
- Comments on Issues and Pull Requests: ON
- Include your own updates: OFF
Homework grade reports are released through GitHub, and using the above settings will ensure that you receive email notifications when your grade report is available.
- Set your profile name to your real name
-
Upload your SSH key by adding the contents of your
id_rsa.pub - Enable Github and Github email notifications
Join the Course GitHub Classroom and Starter Assignment
Connect your GitHub account with the course using GitHub Classroom:
- Sign in with the same GitHub account you set up above (preferably your @usc.edu email).
- Authorize GitHub Classroom if prompted.
-
Click on the
classroom-starterassignment you see in our Github Classroom, or click this link directly. It will connect yor Github account to our semester’s Github organization and repositories. Accept the course assignment if/when prompted to create your copy of this “dummy” repository. You do not need to do anything with it now, but we may use it in lab 1 to practice withgit. But you will not have access to the lab repository described below until you do this step successfully. - Joined the GitHub Classroom and joined the starter assignment
Resources Repository
We expect you to complete labs in your VSCode environment. Each week, the lab material will be posted to the resources repository. Let us perform the one-time clone of the repo.
In the VS Code Terminal, navigate to your cs104 or cs104-repos folder if you haven’t:
GCloud / Windows WSL
cd ~/cs104-repos
Mac
(Replace Documents with the appropriate path where your cs104-repos folder is located.)
cd ~/Documents/cs104-repos
- Type
git clone git@github.com:usc-csci104-spring2026/resources.git - It should download and create a folder named
resourceswhere you will then find aREADME.mdfile. You can verify by typingcd resourcesand thenlsto list the files. You should seeREADME.mdlisted. If successful, your terminal should look something like this.

In the future, whenever it’s time to do lab, just go to the location of this repo (e.g. cd ~/cs104-repos/labs) and type git pull to get the new resources!