GitHub Repository: https://github.com/cos316-s26/assignment1
The remainder of this guide details the steps you will need to take to be ready to use GitHub.
Creating a GitHub Account
If you already have a GitHub account you are willing to use for this course, then you’re done - proceed to the next step.
Otherwise, visit the GitHub registration page and follow the onscreen instructions to register for an account. You will want to select “Free” as your subscription option, and ensure the “Help me set up an organization” box is unchecked.
Creating your repository
Once you have access to the assignment repository, you will want to create your own repo on GitHub and then clone a copy of the repository to your own machine so that you can work on it. Do not clone the class template directly. From here on, the process is similar to how you would contributed to any other git project hosted on GitHub.
How to create your repository from the assignment template:
Navigate to the assignment GitHub URL.
Click the green “Use this template” button at the top of the page.
Select “Create a new repository.”
Configure your settings.
Owner: Select your GitHub account.
Repository name: Use the format assignmentX-yourusername.
Choose visibility: Private (DO NOT skip this).
Click “Create repository.”
Cloning (downloading) your repository
There are two ways to then clone your repository (not the assignment template):
Via command prompt. Open a terminal window using the Git-capable terminal from the first assignment setup. Navigate to the directory you are using for this course, then enter the following command:
git clone <URL of your assignment repo>
For example:
git clone https://github.com/cos316-s26/assignment1-cold-night
You will need to enter your GitHub credentials to authenticate yourself. Since GitHub has deprecated password-based authentications, you may need to create a personal access token for authentication moving forward (details here)
Alternatively, you can set up SSH with your GitHub account. This can help to avoid git’s authentication prompts for repository operations. GitHub provides a guide on setting this up.
Via GitHub Desktop. GitHub Desktop is a graphical Git/GitHub interface for macOS and Windows. You may find it easier to use, especially if you have never used Git or similar version control software before.
Download GitHub Desktop here. Log in with
your GitHub account. (If you are not prompted, you can do this manually from
File -> Options).
Then choose File -> Clone repository and select the repo from the list, or
enter the URL manually.
Pushing
As before, there are two ways to do this:
Via command line. To commit your changes, execute the following command from within your cloned local copy of the assignment repository:
git commit -a -m "<brief summary of changes>"
This will add all local changes to this commit. Instead of -a, consider
using git add to select changed files you want to include in your next
commit. Then, to push your changes to the remote repository hosted on GitHub: run git push
Via GitHub Desktop. Select the changes you would like to commit using the change list on the left, and enter a description of the changes in the text box on the bottom left. Then click Commit to master.
To push your changes to the remote GitHub repository, click the Push button in the top toolbar, next to the Current Branch dropdown. If someone else has made changes to the repository since the last time you pushed, you may first need to fetch or pull these changes, which is done using the same button.
In this section, we you will get your development environment set up with the necessary language compilers, libraries, and tools to complete assignment 1 and future assignments & precepts.
The assignments and precepts in this course assume that you have a few tools and libraries available in your development environment. Any way you get them is fine, and they should generally be relatively easy to find and install on most Linux distributions, BSDs, macOS, and Windows using Windows Subsystem for Linux (WSL).
Note: before installing, you may go down to the “Verifying you have the right tools installed” section first to see what tools you already have; chances are you’ve already installed some of them (like git) locally.
In addition you should have either Firefox or Chrom[e|ium] installed for one of the precepts where we will inspect HTTP traffic using those browsers. Recent versions of the Edge browser which are based on Chromium and include Chromium’s developer tools will likely also work.
Note: All commands below will start with a ‘$’ character; be sure to exclude it from the actual command you’re running.
Most recent Linux distributions should have the necessary tools available from their respective package managers. Some Long-Term-Support (LTS) versions may have an older version of Go, in which case you can use the instructions on the Go website to install a newer version of Go.
Below are instructions for a couple popular distributions. You will typically
need root permissions (i.e. prefix the commands with sudo or login as root) to
install packages:
$ apt-get install git curl build-essential golang sqlite3
$ pacman -S git go sqlite3 curl base-devel
$ apk add git go build-base sqlite curl
First, you must have the XCode Command Line Tools from Apple installed. These already include a C/C++ compiler and make.
You can obtain the remaining tools from a number of package managers available for macOS (e.g. Homebrew, MacPorts), or you can also download and install universal packages from each tool’s respective website.
A simple way using MacPorts is with the following command:
$ sudo port install git go curl sqlite3
Or with homebrew:
$ brew install git go curl sqlite3
To work in a Windows environment, we recommend using Windows Subsystem for Linux, which provides a Linux environment alongside Windows. By default, WSL provides a Ubuntu distribution of Linux. Follow the installation instructions for WSL from the official documentation, then use the instructions above for Linux to install the tools.
You may be able to complete assignments with these tools installed on Windows without WSL, but your mileage may vary and course staff may not be able to offer help with such a setup. We strongly recommend enabling and using WSL if you are on Windows.
Most likely, you will be using the default Ubuntu flavor of WSL, in which case the following command will install all the necessary tools:
$ sudo apt-get update
$ sudo apt-get install git curl build-essential golang sqlite3
Once you’ve installed the tools, running the following commands in a shell should result in similar output (slight variations are expected on different operating systems). Also, the exact output and versions of the tools may be different, so don’t worry about a version mismatch between what you have locally; as long as they are (relatively) up to date then you should be fine.
$ git version
git version 2.34.1
$ go version
go version go1.18.5 linux/amd64
$ echo "select (316 + 1021)" | sqlite3
1337
$ curl -I https://www.google.com
HTTP/2 200
server: nginx
date: Wed, 26 Jan 2022 16:41:20 GMT
content-type: text/html
content-length: 3859
etag: "xsmg9fnyjsw7c3qidhrrb62g071vfnls"
accept-ranges: bytes
...
$ g++ --version
g++ (GCC) 10.3.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
OR
$ clang --version
clang version 7.1.0 (tags/RELEASE_710/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /nix/store/ass1sf1bx07qvlrg02nymxnyzp1cpxz7-clang-7.1.0/bin
$ make --version
GNU Make 4.3
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.