CSCI0200
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Help
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
1
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
--- tags: resources --- # CS200 GitHub Guide We use GitHub and git to give you access to project code, to allow you to save your work online so you can access it from anywhere, and to facilitate collaboration on partnered work. In CS200, we will be expecting you to access git through the terminal/command line and through GitHub. GitHub does have a companion app, but we do not recommend you use it and will not be able to support you in making it function. ## What is GitHub? GitHub is a code-hosting platform that is used by many programmers to save their code and access it from any machine. Think of it like “the cloud” but for code projects! This guide is your go-to resource for help with GitHub/git setup as well as git commands you should know in order to interact with GitHub from your local machine. ## Making an Account First, you're going to need a GitHub account which will be an invaluable resource to you for the rest of your computer science career (both at Brown and beyond). To create an account: 1. Go to www.github.com 2. Select "Sign up" in the upper right corner 3. Follow the steps on the website to get your account all set up :) ## Installing Git Thankfully, installing git on your computer is super easy! First, check if you already have git installed on your computer. To do this, type `git --version` in your terminal. If you already have git installed, your terminal should print the version you have (the version you have shouldn't matter, as long as you have it installed). You can ignore the rest of this section. If you don't already have it installed, follow the instructions below: ### On a Mac - Download an installer at [this link](https://sourceforge.net/projects/git-osx-installer/files/), the version doesn't matter - Follow the prompts to install Git - Verify you have Git installed by typing `git --version` in your terminal ### On a Windows - Go to [this page](https://git-scm.com/downloads), and click “Windows.” This should prompt an automatic download of git, but if not, click the link to manually download git. - Open the .exe file that was downloaded and click next through each of the installation pages (the default settings are perfect for us!). - Verify you have Git installed by typing `git --version` in command prompt. ## Configuring Git Settings Now you have to connect git on your computer to your GitHub account. - First type into your terminal / command prompt window: `git config --global user.email “<email>”` where \<email\> is replaced with the email you used to make your GitHub account (don't forget the quotes!). Then type: - git config `--global user.name “<name>”` where \<name\> is replaced with your username (don't forget the quotes!). Nothing should print in the terminal after you hit enter when you do these steps, but they are important for when you are trying to update your GitHub code later! ## Authentication to GitHub When you connect to a GitHub repository from Git, you’ll need to provide credentials to prove that you are who you declare to be. To do this, you can create a Personal Access Token. **Note:** If you had a GitHub account before, you may have used a password-based authentication. This is no longer supported, so you also need to follow the steps below! - Use this [guide](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) to create your Personal Access Token. - On step 7, when giving your token an expiration date, choose the ‘No expiration date’ option. (Ignore the GitHub warning). If you choose any of the other options, you will have to create a new token when this one expires. - On step 8, when defining the scope of the token, you can select as many scopes as you wish but make sure to select repo - Once created, copy the token and save it somewhere you can easily access e.g., notes or email Every time you try to clone / push to GitHub it will ask for your password, but what it's actually looking for is your access token. This gets really annoying. We'd recommend configuring your computer to do this automatically. **Important:** save yourself a lot of future pain by typing the following into your terminal / command prompt: - `git config --global user.password "<access token>"` where \<access token\> is replaced by the access token you just created! The first time you clone an assignment after following these steps you may be prompted for your GitHub username and password (this will be your personal access token). Please enter these and you should be all set! ## Git Terminology Before we jump into the important git commands we will be using, here is some important GitHub terminology you should familiarize yourself with:<br> - **Repository** → a GitHub repository – or repo for short – is what a project on GitHub is called. Each time you accept an assignment for CS0200 by clicking on the assignment link, GitHub will create a repository for you for that project.<br> - **Commit** → The cool thing about GitHub is that it can keep track of all of the versions of your project as you edit them. Each project “version” is called a commit. It is basically a snapshot of your project at a moment in time, and it is up to you to create commits when you reach points in your project that you do not want to lose. (Your project will be saved on your local machine, but in order to save a snapshot on your GitHub, you must create a commit and push it to your GitHub). It is good practice to create commits regularly so if something gets messed up while you are coding, you will have old versions to look back at stored on your GitHub repository. The git commands below might prove useful when trying to get your code from GitHub to your computer or when you are trying to commit your code. ## Need To Know Commands | Command | Explanation | |------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `git clone <repo URL>` | Once you accept an assignment and your repo is created, click the green “Code” button and copy the link that is listed. That link is your repo URL. Then, in your terminal, type this command with the repo URL to make a folder with the code in your repo on your computer. The folder will be made in whichever directory you are currently in, so be sure to `cd` into your desired directory before running this command! | | `git add <file>`<br> <br>`git add -A` | This command is the first of 3 commands that you need to run when you are trying to get the code you wrote on your computer back up to GitHub. You must add the files that you want to update on GitHub. You can do this by running `git add` with one file specified at a time, or you can use `git add -A` to update all files (typically what is used when you want to save a snapshot of your current code). | | `git commit -m “message”` | Once you have added all of the desired files using `git add`, you are ready to commit these changes and save your snapshot to GitHub! This command is the 2nd of 3 commands you must run to get your code edits back up to GitHub. It creates the commit, or “snapshot” that we will soon send to GitHub. Instead of `<message>`, you should write something informative about what you've changed! | | `git push` | Now you’re ready to push the changes to GitHub! Running this command will send your commit to the online repository where your code is stored. This is the final of the 3 commands you will run to get your code back to GitHub! After running this, go on your GitHub repo and ensure that your updates were made! | | `git pull` | This command lets you pull any changes on this repository that are present on GitHub but not on your local machine. No need to worry about this for solo projects, but if you’re working on partner projects, pull before you begin working / after you commit and before you push in order to get all your partner’s changes! | If you have any git problems, feel free to post on Ed! ## Accepting an Assignment on GitHub Classroom Accepting assignments through GitHub Classroom can be a confusing process – do not fear, this section is here to help! Follow these steps and accepting assignments should be a breeze (but if it's not, please come to TA hours and we'll be more than happy to help you troubleshoot). :::info **Aside: Before the First Assignment** *For CS17/19/111 students this step should be done before HW1A, for CS15 students this step should be done before HW2* Create a CS200 folder on your computer. This folder will hold all of your assignments for the rest of the semester. We recommend putting it on your Desktop (Mac) or the C Drive (Windows) for ease of access, but you can put it wherever makes sense for you! ::: **Follow these steps for **every**(!) assignment you accept through GitHub Classroom this semester.** 1. Accept the assignment on GitHub Classroom by following the link on the handout and clicking the “Accept this assignment” green button 2. After a few seconds, refresh the GitHub page, you should see a link labeled "Access your Assignment" – click this link 3. Click the green “Code” button, which will open a dropdown that says “Clone”, then copy the link that is shown. <center> <img src="https://i.imgur.com/8834CLx.png" width="40%"> </center> 4. Open up the terminal (Mac) or command prompt (Windows) of your computer 5. Use the `cd` command to enter into the CS200 folder of your computer. (take a look at our [Terminal Guide](https://hackmd.io/Q5-3cN82TYqV4NaztvhxnA) for more info on what `cd` and other shell commands do) <br> *If your CS200 folder is on your Desktop/C Drive, you can `cd` there as shown below:* <br> `cd ~/Desktop/CS200` or `cd /Users/<yourName>/Desktop/CS200`(Mac) <br> `cd C:\CS200` (Windows) 6. Now you’ll have to paste the link from before in order to clone the repository locally. You should type `git clone <pasted link>` (without the “<>” brackets) Yay! You now have cloned the assignment onto your machine! To run it in IntelliJ you can go to File > Open > and navigate to your assignment folder (click the folder with the name `<assignment>-<github login>`)! ______________________________ *Please let us know if you find any mistakes, inconsistencies, or confusing language in this or any other CSCI0200 document by filling out the [anonymous feedback form](https://docs.google.com/forms/d/e/1FAIpQLSdFzM6mpDD_1tj-vS0SMYAohPAtBZ-oZZH0-TbMKv-_Bw5HeA/viewform?usp=sf_link).*

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully