π§ Start Here
Scroll down to complete this route
GitHub Basics (Local Terminal Edition)
RouteID: 006 Route Name: The Rope (Git Basics & Local Terminal) Wall: The Systems Wall Grade: 5.10a Routesetter: Adrian Time: ~45-60 minutes You'll need: A terminal (Terminal on Mac/Linux, Git Bash or PowerShell on Windows).
Why this route exists
In science we make mistakes. We break code that used to work. We delete the wrong file. We overwrite the "final_final_v3.csv" dataset.
Git is your safety rope. It is a Version Control System that tracks every change you make. It lets you:
- Save checkpoints of your work (Commits).
- Travel back in time to when your code worked (Checkout).
- Experiment safely without breaking the main project (Branching).
This route focuses on Local Git: using the terminal to manage your own work before you ever upload it to the cloud (GitHub).
What you'll build
You will create a small local Git repository and practice the full commit β push workflow.
- Configure your digital identity.
- Initialize a repository.
- Commit files to history.
- Branch to try an experiment.
- Merge the experiment back into the main timeline.
Exercise 0: The Knot Check (Installation & Config)
Goal: Ensure Git is installed and tell it who you are. Part A: Installation Check Git is not always pre-installed. We need to verify you have the tool before we start. For macOS Users:
- Open Terminal (Cmd + Space, type "Terminal").
- Run: git --version
- If you see a number: You are good.
- If you see a popup: macOS will ask to install "Xcode Command Line Tools". Click Install and wait for it to finish. (You don't need the full Xcode app, just the tools).
For Windows Users: Note: Do not use Command Prompt or PowerShell. You must use Git Bash.
- Go to git-scm.com/download/win.
- Download the 64-bit Git for Windows Setup.
- Run the installer (accept all default settings).
- Once finished, open the application called Git Bash.
- Run: git --version
For Linux Users:
- Open your terminal.
- Run: git --version
- If missing: Use your package manager (e.g., sudo apt install git).
Part B: Configuration (Identity)
The Beta: Git stamps every save (commit) with a name and email. If you don't set this, Git will yell at you later.
Do: Run these two commands in your terminal (swap in your info): git config --global user.name "Your Name" git config --global user.email "your.email@example.com"
Belay Check: git config --list Success: You should see your name and email near the bottom of the list.
Exercise 1: Establish Base Camp (Create Repo on Browser)
Goal: Create an empty repository on GitHub that you own.
Do:
- Sign up/Log in: Go to github.com. If you don't have an account, sign up (use your academic email if possible).
- Create: Click the + icon in the top-right corner and select New repository (or the green "Create repository" button on the dashboard).
- Settings:
- Repository name:
experiment-log(orchem169-git).- Your repository name may differ; thatβs fine. Just be consistent.
- Owner: Your personal account.
- Visibility: Public.
- Initialize this repository:
- [x] Add a README file (Crucial: Check this box!).
- Repository name:
- Launch: Click Create repository.
Belay Check: You should see a web page with your repo name and a file list containing just README.md.
Exercise 2: The Traverse (Cloning)
Goal: Bring that cloud repository down to your local machine.
The Beta:
- Clone: Makes a complete copy of the cloud repo on your laptop. It connects the "Remote" (GitHub) to your "Local" (Computer).
- The URL: The address Git uses to find your Base Camp.
Do:
-
Get the URL: On your GitHub repo page, click the green <> Code button. Ensure HTTPS is selected. Click the Copy icon (clipboard).
-
Go to Terminal: Open your terminal/Git Bash.
-
Navigate: Move to where you want the project (e.g., Desktop).
cd Desktop
-
Clone:
git clone <PASTE_YOUR_URL_HERE>
(Example: git clone https://github.com/yourname/experiment-log.git)
- Enter the Camp:
cd experiment-log
Belay Check: Run ls (Mac) or dir (Windows). You should see the README.md file that you created on the website. You are now synced.
Exercise 3: The Work (The Commit Cycle)
Goal: Make a local change and save it.
The Beta (The Two-Step Save): Git saving is manual.
- Staging (
git add): Put the file in the box. - Committing (
git commit): Seal the box and label it.
The "Clip" Analogy
In rock climbing, as you climb higher, you are "run out"βif you fall, you lose a lot of progress (or hit the ground). When you reach a bolt, you clip your rope in. Click. Now you are safe. If you fall, you only fall back to that bolt. You don't lose the whole route.
Git is the same:
- Working on code: You are "run out." If you mess up or delete a file, it's gone.
git commit: You clip the bolt. You create a permanent checkpoint. No matter how badly you mess up later, you can always fall back to this exact moment.
The Golden Rule: Clip early, clip often. (Commit small changes frequently).
Do:
- Create a file: Create a new text file called
log.txtinside the folder. Add the text: "Day 1: Setup complete." - Check Status:
Bash
git status (Result:
log.txtis red/untracked). - Stage it: Bash git add log.txt
- Commit it: Bash git commit -m "Added first log entry"
Belay Check: Run git log. You should see your new commit ("Added first log entry") sitting on top of the "Initial commit".
Exercise 4: The Crux: Push to GitHub (Authentication)
Goal: Send your local commit to GitHub. This is the hardest step because of security.
When you run git push, GitHub will ask for a password. Your website password will NOT work. You need a Personal Access Token (PAT).
Step A: Get the Token
- In GitHub (Browser), click your profile photo β Settings.
- On the left sidebar, scroll down to Developer settings.
- Select Personal access tokens β Tokens (classic).
- Click Generate new token (classic).
- Give it a Note (e.g., "Class Token"), set Expiration to "90 days", and check the box for repo.
- Scroll down and click Generate token.
- COPY THIS TOKEN. You will not see it again.
Step B: The Push
- In your terminal, run:
git push - Username: Enter your GitHub username.
- Password: Paste the Token you just copied.
- Note: The terminal will not show characters as you paste. Trust that it is there and hit Enter.
Before you start (Troubleshooting 403 Errors) If git push fails immediately with a 403 error (and you are not prompted for a username or password), your computer may be using cached GitHub credentials for a different account.
This is common if you have used GitHub before with another account. If this happens:
- Clear any cached GitHub credentials, then retry
git pushso Git prompts you again. - On macOS, you can run:
security delete-internet-password -s github.com
Belay Check: After pushing, run git status again. Notice how Git reports that your branch is now up to date with the remote.
Anchor Challenge (Optional)
Task: The online README Edit.
- On GitHub.com (in the browser), click the pencil icon to edit
README.md. - Add a sentence describing your project and click Commit changes (green button).
- Now, your Cloud is ahead of your Local.
- Question: How do you update your local laptop to get that new sentence? (Hint: The opposite of push is
pull). - Try running
git pullin your terminal and check the file content.
Exercise 5: The Summit Photo (Generating the Artifact)
Goal: Create a single text file that proves you did the work (Repo URL + Commit History) without leaving the terminal.
The Beta (Redirection): Normally, commands print to the screen (Standard Output). You can redirect that text into a file using > and >>.
>: Create/Overwrite (Saves output to a new file).>>: Append (Adds output to the bottom of an existing file).
Do: Run these three commands to generate your submission file:
Capture your Repository Link: (This command prints your remote URL and saves it to a file)
git remote -v > lastname_firstname_RID_006_deliverable.txt
Append your History: (This adds your commit log to the bottom of that same file)
git log >> lastname_firstname_RID_006_deliverable.txt
Verify the content: (This prints the file content to the screen so you can check it)
cat lastname_firstname_RID_006_deliverable.txt
(Windows users (I think!): type lastname_firstname_RID_006_deliverable.txt)
Success Check: The file lastname_firstname_RID_006_deliverable.txt should look like this:
origin https://github.com/yourname/experiment-log.git (fetch) origin https://github.com/yourname/experiment-log.git (push) commit 1a2b3c... Author: Your Name <email> Date: ... Added first log entry ...
Deliverables
- Upload: Submit the
lastname_firstname_RID_006_deliverable.txtfile you just generated to the course portal. - A short logbook entry (plain text, ~5-10 sentences): Briefly describe:
- what was tricky or confusing
- what helped you get unstuck
- one thing you learned about working with real data
- File naming convention β
lastname_firstname_RID_006_logbook.txt - Focus on clarity and completeness.
Submission
Submit your files by uploading them to this submission link: SUBMIT LINK
Please upload both:
- your β¦
deliverable.txt file - your logbook file
Make sure filenames follow the naming conventions above.
We will continue to fine-tune our submission system as the course moves along. Thank you for your patience as a valued member of the CHEM 169/269 Climbing Gym.
π Route Complete!
Great work!