Windows · GitHub · TortoiseGit

If you’re looking for a reliable and user-friendly place to host Git repositories, GitHub is my go-to choice. GitHub Free supports both public and private repositories, although some advanced features require a paid plan. You can host your source code or documents without paying for a plan. If you do not already have a GitHub account, complete Step 01 before creating your repository.

01Creating a GitHub account

  1. Open the GitHub website.
  2. Select Sign up and follow the instructions to create your account.
  3. Once the registration is complete, sign in to GitHub and continue to the next step.

02Creating a repository on GitHub

Once you’ve created an account on GitHub, log in, and you’ll be greeted by your dashboard, which should look something like this:

GitHub dashboard with the new repository control highlighted
GitHub dashboard with the repository creation control highlighted.

The red-circled button in the image above opens the form for creating a new repository. Click it to get started. In the current GitHub interface, you can also select the plus sign in the upper-right corner and choose New repository.

GitHub will prompt you to name your repository. Let’s call ours “ExampleRepo” for this example. To keep things organized, add a short description. This will help you distinguish it from other repositories later.

If you want to keep your repository private, select the Private option. For this guide, we’ll use a public repository.

GitHub recommends adding a README file so that visitors can understand the purpose of the repository. GitHub can initialize the repository with one for you. Select Add a README file before creating the repository.

The image below highlights the key fields to check.

GitHub form for creating a repository
Repository name, description, visibility, and README options.

Click Create repository. The repository is now available on GitHub.

You now have a place to store, manage, and collaborate on your code or documents. From here, you can add files, clone the repository to your local computer, or invite collaborators.

Newly created GitHub repository
The newly created repository on GitHub.

03Cloning a Git repository

TortoiseGit

To manage the repository from a Windows computer, you need Git software installed locally. There are several options available, but in this guide, we’ll use TortoiseGit together with Git for Windows.

TortoiseGit is a Git client for Windows that integrates with File Explorer. This allows you to manage repositories through the right-click context menu.

Once it is installed, you can clone repositories, commit changes, and push updates without using the command line.

Git for Windows: setting up your Git environment

TortoiseGit is a Windows shell extension. It provides the File Explorer interface, but it still needs a working Git executable to run Git commands in the background. A normal Git for Windows installation is detected automatically by TortoiseGit.

The Git implementation used in this guide is Git for Windows:

04Cloning your GitHub repository

Now that you have TortoiseGit and Git for Windows installed, you’re ready to download the Git repository you just created. In Git terminology, this is called cloning the repository.

Here’s how to do it:

  1. Open File Explorer and go to the folder where you want to store your Git repository.
    • In my case, I have a folder called Misc, and I want to clone ExampleRepo inside it.
  2. Right-click inside the folder, such as Misc, and select Git Clone… from the menu.
  3. A Git Clone window will open and ask for the repository URL.
  4. Get the repository URL from GitHub:
    • Open ExampleRepo on GitHub.
    • Select Code, choose HTTPS, and copy the repository URL.

    https://github.com/vivekbhadra/ExampleRepo.git

  5. Paste the URL into the TortoiseGit Git Clone window and select OK. TortoiseGit will download the repository and create a local copy.
TortoiseGit clone command in the Windows context menu
Selecting the TortoiseGit clone command from File Explorer.

The Git Clone window shows the folder where the repository will be cloned. If you want to change the destination, select Browse and choose a different folder.

Once you’re happy with the location, select OK.

TortoiseGit will start downloading the repository. When the process is complete, you will have a local copy of your GitHub repository ready to work with.

TortoiseGit showing a completed clone operation
TortoiseGit reports that the clone operation has completed.

Close the Git Clone window once the process is complete.

Go back to the Misc folder. A new folder named ExampleRepo has been created. If you selected a different destination during cloning, check that location instead.

Open this folder. Inside, you will find README.md, the README file initialized while creating the repository. Your local repository is now ready for further development.

05Populating the repository with new files

Adding new files locally

Let’s say you want to place two files under version control:

  • abc.doc (a Word document)
  • xyz.c (a C source file)

I’ve deliberately chosen two different file types. Git can track both text and binary files. However, text-based files normally provide more useful line-by-line comparisons and merge behavior than binary formats such as Word documents. In real projects, repositories are usually organized around a project or product rather than simply by file type.

Copying files to the repository folder

Copy abc.doc and xyz.c into the ExampleRepo folder in Windows.

The ExampleRepo folder now contains:

  • README.md (created during repository initialization)
  • abc.doc
  • xyz.c

Now that these files are in place, you can add them to Git’s version history.

Files copied into the local ExampleRepo folder
The new files inside the local repository folder.

06Recording your changes in the local repository

Now that we’ve added the files to the ExampleRepo folder, we need to tell Git to track them. A commit records a snapshot of the selected changes in the local repository.

Here’s how to do it:

  1. Right-click inside the ExampleRepo folder in File Explorer.
  2. Select Git Commit → “main”… from the context menu. The branch name shown in your installation may differ. Older repositories and the screenshots in this guide may use master instead.
  3. A commit window will open and ask for a description of your changes.
    • In the Message box, write a short note explaining what you are committing.
    • For example: “Add abc.doc and xyz.c as initial files.”
  4. Below the message box, you will see the files that Git has detected.
    • Select the files you want to commit.
    • If you see unnecessary files, such as editor backup or generated files, leave them unselected. Files that should never be tracked can be added to a .gitignore file.
  5. Select Commit to record the changes.

At this point, your files are part of the local repository, but they are not on GitHub yet. That is the next step.

TortoiseGit commit window showing files selected for commit
Select the files and enter a clear commit message.

Select the Commit button. When the commit completes, you will see a result similar to this:

TortoiseGit showing a completed commit
The files have been committed to the local repository.

Close the window.

07Pushing your changes to GitHub

Now that the files are committed locally, the next step is to push the commit to the remote GitHub repository. This makes the committed changes available through GitHub.

Steps to push your changes to GitHub

  1. Right-click inside the ExampleRepo folder in File Explorer.
  2. Open TortoiseGit, then select Push.
  3. A Push window will appear, showing the source branch and remote destination.

The remote is normally named origin. The branch will usually be main for a new GitHub repository, although an older repository may use master. The image below highlights the main areas to check.

TortoiseGit push window showing the local branch and remote destination
Check the source branch and remote destination before pushing.

If the source branch and remote destination are correct, leave the remaining options at their defaults and select OK. TortoiseGit will show the progress of the push. When it completes, a confirmation message will report that the operation was successful.

TortoiseGit showing a successful push to GitHub
The local commit has been pushed to the GitHub repository.

Open your GitHub repository, and you should see the newly added files listed there.

When you make further changes, follow the same sequence:

  • Commit the selected changes locally.
  • Push the new commits to GitHub.

A quick reminder about repository visibility

Everything discussed so far assumes that the repository is public, so anyone on the internet can view its contents. Do not upload sensitive files or private information. If the project requires controlled access, set the repository to private.

Full workflow · 1 min 16 sec

Watch the complete video demonstration

The video below demonstrates the complete process, from creating a GitHub account and repository to cloning it, committing files, and pushing the changes to GitHub from Windows.

Git for Windows: from creating a GitHub account to completing the first push.

Discover more from Tech For Talk

Subscribe to get the latest posts sent to your email.

Leave a Reply