Skip to content

steph1111/CS11-F24

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

52 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CS11-F24

CS11 Fall 24 Supplemental Instruction GitHub

Getting started

0.1 Installing git (WSL)

  1. Confirm git is installed by running the following command in your terminal
    git --version
    You should get back something that looks like git version 2.39.0
  2. If you did not receive a similar message run the following command.
    sudo apt-get install git

0.2 Installing git (Cygwin)

If you have Cygwin on your windows device, when you were installing, Cygwin gave you the option to install additional packages, one of these was for Git. Chances are you did not install this, but we can add packages after installation (kinda). There is no package management in Cygwin outside of the setup program, so you will have to run setup-x86_64.exe again.

  1. Open File Explore then to Downloads on your device
  2. Search for setup-x86_64.exe and open the file
  3. Go through the set up process again (choose the same options as last time) until you reach the Select Packages page. Here use the search tool to search for "Git". Choose the package named Git with description Distributed version control system packages Note: now is a good time to install any additional packages you may want like Vim
  4. Finish the rest of the set up process
  5. Open your Cygwin terminal and confirm git has been properly installed by running
    git --version
    You should get back something that looks like git version 2.39.0

0.3 Installing git (Mac and Linux)

  1. By default, git should be installed on Mac and Linux systems
  2. Confirm git is installed by running the following command in your terminal
    git --version
    You should get back something that looks like git version 2.39.0
  3. If you did not get a version number, follow the this guide: Install Git

1 Create a GitHub account

GitHub is the free web based platform we and many other software engineers use to share and collaborate on projects as well as control version history. Screen Shot 2023-09-10 at 7 39 35 AM

  1. Go to GitHub and follow the steps to create an account
  2. Return to the terminal (cygwin or your standard terminal) to configure git
  3. Set up your username using the following command where <your_GitHub_username> is the username you chose when creating your GitHub account
    git config --global user.name <your_GitHub_username>
    git config --global user.name CS11SI
  4. Set up your email using the following command where <your_GitHub_email> is the email you used when creating your GitHub account
    git config --global user.email <your_GitHub_email>
    git config --global user.email [email protected]

2.1 Set up SSH (Cygwin)

  1. Open Cygwin as Administrator and enter the following command to configure SSH

    ssh-host-config
  2. Enter yes for the prompts

  3. You will be prompted to with the text below

    ***Query: Enter the value CYGWIN for the daemon: []

    For the value enter ntsec

    ***Query: Enter the value CYGWIN for the daemon: [] ntsec

2.2 Set up SSH (Mac, Linux, WSL)

  1. SSH should already be on Mac and Linux systems

3 Generate an SSH key

  1. Generate an SSH key to connect your system to your GitHub account
    ssh-keygen
    • When it asks for the location to put the file hit enter
    • Also just hit enter when it asks for the password, unless you can remember it (not recommended)
  2. Copy the generated ssh key
    cat ~/.ssh/id_rsa.pub

4 Add the SSH key to GitHub

  1. Return to GitHub and open your settings by clicking on your icon then βš™οΈ settings

  2. Scroll to πŸ”‘ SSH and GPG keys

    Tabs
  3. Click the New SSH Key button located in the top right corner.

  4. Choose a name for the key (something such that you'll remember what computer/system it was for)

  5. Paste the key from step 2 into the Key box

  6. Save the key by clicking Add SSH Key


5 Fork the repo to your account

  1. Open the CS11-F24 GitHub repo in your browser: https://github.com/steph1111/CS11-F24

  2. At the top of the page click on fork

    fork
  3. Follow the steps to fork the repo to your account by creating a new fork. Click on create fork when you are finished. This creates your own personal version of this repository

    fork page

6 Clone your forked repo to your system

  1. Open your forked repo. At the top of the page click the green code button. Open the SSH tab and copy the link

    Screen Shot 2023-09-10 at 6 50 51 PM
  2. Return to your terminal and navigate using cd to where you would like this repo contents to live with your file system

  3. To clone your repo use the git clone command and paste the link from step 1. This points to the existing repo on GitHub and makes a connected copy, or clone, on your system

    git clone <link_here>

    Here is an example of how I would clone my repo (your link is different)

    git clone [email protected]:steph1111/F23_CS11_SI.git
  4. To confirm the clone was successful list your files with ls. You should see the name of the cloned repo in your current directory


Maintaining your repo

0 Sync and pull the changes

I will be updating my upstream version of your repo before SI sessions to add new content. In order to get the new content into your forked repo you must sync and pull the changes. Every time you want to work on your repo I recommend heading to your forked repo and seeing if there are upstream changes to be synced and pulled

  1. Open your forked repo in GitHub. If there are no changes you should see a message that looks like the following stating this branch is up to date. If this is the case it means I have not made changes and you can ignore the following steps. up_to_date

  2. If there are upstream changes to merge there should be a message on this page similar to the following: x_commits_behind This means I have main changes to the upstream repo that need to be synced to your fork

  3. Click on the button titled πŸ”„ Sync fork, you should see a window stating the code is out of date. Click update branch

  4. Next navigate to your fork on your system

  5. Enter the command git pull to pull the changes on GitHub onto your device

    git pull
  6. Work on the exercises as you would any code on your device


1 Add changes

Once you make some changes you would like to be documented you need to start by adding them.

  1. Add a singular file
    git add file_name
  2. Add all files modified
    git add .

2 Commit your changes

Committing changes is how you can mark versions of your code you would like to be tracked. It is a good idea to commit changes before and after you add/remove a feature that way there is a record of your changes. Also commit changes after you have finished a session of programming then push (see following section)

  1. To commit changes you use the git commit command. The parts of the command are as follows:

    • git: Denotes we are using a git command
    • commit: The name of the command is commit, this is what we would like to do
    • -m: This is a flag that says we would like to add a commit message
    • "Message here: Between quotes state what changes you are committing

    All together the git commit command syntax looks like this:

    git commit -m "Message here" 

    An example commit may be

    git commit -m "Added endl to move to the next line"
  2. You will receive a short message summarizing the changes


3 Push your changes

Once you have finished a coding session it is a good idea to push your commits. The push command is basically the opposite of pull. push takes the changes (commits) you made on your local system and sends them to GitHub.

  1. Add and commit your changes (see above)
  2. Enter the command git push to push the changes from your system to GitHub
  3. You can confirm this worked by heading to GitHub and seeing the changes reflected on your repo page
    git pull

About

CS-11 Fall 2024 SI GitHub Repo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published