Git & GitHub Cheat Sheet
Quick Concepts
- Git: A version control system for tracking changes in files and coordinating work among multiple people.
- GitHub: A web-based hosting service for version control using Git.
SSH Keys
- SSH Key: A secure access credential for the SSH protocol.
- Check for SSH Key: Run
less ~/.ssh/id_rsa.pub
in terminal.
- Create SSH Key: Run
ssh-keygen
and follow the prompts.
- Add SSH Key to GitHub: Copy the SSH key and add it to GitHub under Account Settings -> SSH and GPG keys.
Forking & Cloning
- Fork: Makes a copy of someone else's repository to your account.
- Clone: Makes a local copy of a repository on your machine.
Git Workflow
- Fork Repo: Click "Fork" on the original repository page.
- Clone Repo: Use
git clone <ssh_url>
in your desired directory.
- Stage Changes: Use
git add -A
to stage your changes.
- Commit Changes: Use
git commit -m "Your message"
to commit.
- Push Changes: Use
git push origin main
to push to your forked repo.

Forking Steps
- Log into GitHub or git.generalassemb.ly.
- Navigate to the repo page.
- Click "Fork".
Cloning Steps
- Click "Clone" and copy the SSH URL.
- Navigate to your desired directory.
- Use
git clone
followed by the copied SSH URL.
- Enter the directory with
cd
.
- Open with your code editor using
code .
.
Submitting Changes
- Save changes in your editor.
- Stage with
git add -A
.
- Commit with
git commit -m "Your message"
.
- Push with
git push origin main
.
Key Takeaways
- Use SSH keys for secure communication.
- Check for and create SSH keys with
ssh-keygen
.
- Forking is for experimentation, cloning is for local work.
- Submit changes with
add
, commit
, and push
.
Click here to view the Git workflow visual guide