Working With Git And Github

Published: (February 12, 2026 at 08:06 PM EST)
4 min read
Source: Dev.to

Source: Dev.to

Cover image for Working With Git And Github

Maxwell Wokocha C.

What is Git?

Git is a free and open‑source distributed version‑control system. It tracks changes in any set of files and is most commonly used to coordinate work among programmers collaborating on source‑code projects.

Essential Git Commands

CommandDescription
git pushUploads local repository content to a remote repository.
git commit -m ""Records a snapshot of the repository with a descriptive message.
git add <file>Stages changes in the working directory for the next commit.
git remote add origin <url>Registers a new remote repository (usually on GitHub).
git remote -vLists the current remote URLs.
git config --listShows the current Git configuration.

Note: You’ll need the remote URL for your repository and, if required, authentication credentials.

How to Push from Your Local Environment to GitHub

  1. Download Git Bash – Choose the version compatible with your OS.
  2. Configure Git Bash – Give Git your identity.
  3. Work with the Configured Environment – Create a project folder, initialise a repo, etc.
  4. Clone Your GitHub Repository – Bring an existing remote repo to your machine.
  5. Push to GitHub – Send local commits to the remote.
  6. Show the Content – Verify everything is in place.

1️⃣ Download Git Bash

Install the latest Git for Windows from the official site:

2️⃣ Configure Git Bash (Set Your Identity)

# Set your name (replace <name> with your actual name)
git config --global user.name ""

# Set your email (replace <email> with your actual email)
git config --global user.email ""

Setting user name in Git Bash

Setting user email in Git Bash

# Verify the configuration
git config --list

Git configuration list output

3️⃣ Work with the Configured Environment

# Create a directory for your project
mkdir website
# Enter the directory
cd website
# Initialise a new Git repository
git init
# Check the repository status
git status

Creating a directory and entering it

Git init output

# Create an index.html file
touch index.html
# Open it with vim (or any editor you prefer)
vim index.html

Creating index.html

In vim, press i to enter Insert mode, edit the file, then press Esc followed by :wq to save and quit.

4️⃣ Add, Commit, and Push

# Stage the new file
git add index.html
# Commit with a message
git commit -m "Add initial index.html"
# Add the remote repository (replace <url> with your GitHub repo URL)
git remote add origin 
# Push the commit to the remote master/main branch
git push -u origin master   # or `main` if your default branch is named main

5️⃣ Verify on GitHub

Visit your repository page on GitHub to confirm that index.html appears in the file list.

Happy coding! 🎉
If you run into any issues, double‑check the remote URL and ensure your credentials (SSH key or personal access token) are correctly set up.

Clone Your GitHub Repository

  1. Go to your GitHub page – click the + button and select New repository.

    Create new repository screen

  2. Initialize the repository (add a README, .gitignore, license, etc.) and click Create repository.

    Repository settings screen

  3. Copy the HTTPS URL

    On the next page click CodeHTTPS and copy the URL that appears.

    Copy HTTPS URL

  4. Clone the repository locally

    Open Git Bash (or your preferred terminal) and run:

    git remote add origin 

    Add remote origin command

Push to GitHub

We need to move the index.html file we added to the staging area, commit it, and then push it to the remote repository.

  1. Check the status

    git status

    Git status before staging

  2. Stage the file

    git add index.html

    Git add index.html

  3. Verify the staging

    git status

    The file name should now appear in green, indicating it is staged.

    Git status after staging

  4. Commit the change

    git commit -m "Add index.html"

    Git commit screenshot

  5. Push to GitHub

    git push origin master

    Git push screenshot

Show the Content

Open the GitHub Pages URL (or the repository’s raw file view) to verify that index.html is now live.

GitHub Pages view

All images retain their original sources; only the markdown structure has been cleaned up for readability.

Thank‑you image

Thank You For Your Time. Till The Next Post.

0 views
Back to Blog

Related posts

Read more »