Git and GitHub Setup

Create a GitHub Account

You should already be added to the GitHub Classroom for this course. If not, I suggest reaching out to me first. Otherwise, if you have your own reasons, you can create an account at github.com.

Install Git

(Windows users) Have Git Bash find conda

Quick one-time setup (paste into Git Bash) This will find Miniconda in common Windows locations, add the right lines to ~/.bashrc (that's a configuration file that gets executed every time you open a new terminal), and auto-activate base each time:
# 1) Create ~/.bashrc if missing
[ -f ~/.bashrc ] || touch ~/.bashrc

# 2) Append a smart Conda bootstrap only if not already present
if ! grep -q "### CONDA INIT (git-bash)" ~/.bashrc; then
cat >> ~/.bashrc <<'EOF'
### CONDA INIT (git-bash)
# Try typical Windows installs of Miniconda/Anaconda and source conda.sh if found
for CONDA_ROOT in \
  "$HOME/miniconda3" \
  "/c/Users/$USERNAME/miniconda3" \
  "/c/ProgramData/miniconda3" \
  "/c/Miniconda3" \
  "$HOME/anaconda3" \
  "/c/Users/$USERNAME/anaconda3" \
  "/c/ProgramData/anaconda3" \
  "/c/Anaconda3"
do
  if [ -f "$CONDA_ROOT/etc/profile.d/conda.sh" ]; then
    . "$CONDA_ROOT/etc/profile.d/conda.sh"
    # Auto-activate base on startup; change to 'false' if you don't want this
    conda activate base >/dev/null 2>&1
    break
  fi
done
unset CONDA_ROOT
### END CONDA INIT (git-bash)
EOF
fi

# 3) Apply it to your current shell
source ~/.bashrc

Configure Git

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Set Up SSH Authentication

  1. Check to see if you already have a (public/private) key pair (by trying to print to the terminal the public part):
  2. cat ~/.ssh/id_rsa.pub

    If this prints an output, you can skip to step 3.

  3. Generate an SSH keypair (see this guide)
  4. Upload public key to GitHub
  5. cat ~/.ssh/id_rsa.pub

    Copy the output, then visit github.com/settings/ssh/new and paste it in.

Test SSH Connection

Inside of the terminal, run the following command:
ssh -T git@github.com

If successful, you'll see a greeting message.