DEV Community

Charles
Charles

Posted on

Git for Data Scientists & Data Engineers — my very first beginner guide (Git Bash + GitHub)

Hi, I’m Charles Ndungu. I recently started learning data science and analytics. I’ve never used Git before, but I wanted to share my very first experience with Git and GitHub, step by step, so other beginners like me can follow along.

Repo: https://github.com/Charles-Ndungu/GIT-basics-practice..git


TL;DR

Git tracks changes to files. GitHub stores your tracked projects online. Learn the basic flow: initaddcommitpushpull. This is enough to start working confidently and share work with others.


Why Git matters (short)

  • Reproducibility — you can go back to any previous version.
  • Collaboration — multiple people can work without overwriting each other.
  • Safety — experiment on branches, revert mistakes.
  • Professional — it’s expected in data teams.

What you’ll need


Very simple mental model

  • Local folder = your project
  • git = the thing that watches your folder and remembers changes
  • commit = a saved snapshot
  • remote (origin) = GitHub copy of your project
  • push = upload your commits to GitHub
  • pull = download changes from GitHub

Step 1 — Install Git Bash (Windows) — quick

  1. Download from https://git-scm.com/downloads → pick Windows.
  2. Run the installer → accept defaults. When asked, choose OpenSSH.
  3. Open Git Bash from Start → Git → Git Bash.

Step 2 — Minimal setup (one-time)

Open Git Bash and run:

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

Enter fullscreen mode Exit fullscreen mode


markdown

Step 3 — First Local Project — The Exact Commands I Ran

# create project folder and enter it
mkdir ~/git-basics-practice
cd ~/git-basics-practice

# create a tiny file
echo "hello from git bash" > hello.txt

# start Git in this folder
git init

# check status
git status

# track the file
git add hello.txt

# save a snapshot
git commit -m "Add hello.txt"

# check history
git log --oneline

---

Enter fullscreen mode Exit fullscreen mode


markdown

Step 4 — Create a GitHub repo & push (real moment)

  1. On GitHub: + → New repository
    • Name it git-basics-practice
    • Do NOT initialize README or .gitignore
  2. Copy the HTTPS URL, for example: ssh-keygen -t ed25519 -C "you@example.com"

### Authentication Notes:

- GitHub no longer accepts account passwords on the command line. Use a Personal Access Token (PAT) instead of your password if prompted.
- Alternatively, set up SSH keys (recommended long-term):add the public key to GitHub Settings → SSH and GPG keys.

---

Back in Git Bash, run:

Enter fullscreen mode Exit fullscreen mode


bash
git remote add origin https://github.com/your-username/git-basics-practice.git
git branch -M main
git push -u origin main



### Troubleshooting — real things I saw (and how to fix)

- **fatal: User canceled device code authentication** → if you close the browser prompt, Git may fall back to asking for username/PAT. Re-run git push and use PAT or set up SSH.

- **Permission denied (publickey)** → SSH key missing on GitHub. Add your **id_ed25519.pub** to GitHub > Settings > SSH keys.

- **404** when opening repo in browser → check the exact repo name and whether it’s private. Pro tip: I had an extra **.** at the end of my remote URL once (**GIT-basics-practice..git**), which created a repo name with a trailing dot and gave me a confusing 404. Always check **git remote -v**.

---

Enter fullscreen mode Exit fullscreen mode


markdown

Step 5 — Pulling changes (download)

If someone edits the repo or you edit on GitHub, bring changes down with:

git pull origin main

---

Enter fullscreen mode Exit fullscreen mode


markdown

Short cheat-sheet (commands to remember)


git init                 # start tracking a folder
git status               # see file status
git add <file>           # stage file
git commit -m "msg"      # save snapshot
git log --oneline        # view history
git remote -v            # show remotes
git push -u origin main  # upload commits
git pull origin main     # download commits
git checkout -b name     # create + switch branch

Enter fullscreen mode Exit fullscreen mode


markdown

A tiny real lesson (my raw beginner moment)

I pushed successfully, but when I opened my repo in the browser I got 404. I later discovered my remote URL had an extra dot (GIT-basics-practice..git) so the repo name ended up with a dot. Git still accepted the push, but the usual browser link (without the dot) returned 404. If you hit 404, check git remote -v and make sure the URL is exactly what you expect.

Top comments (0)