Press "Enter" to skip to content

Lesson 15.4: Using GitHub to upload and download a solution

This will be the last cleanup lesson for a while. After this, we’ll get back to adding more features to the game.

In this lesson, I’ll show you the basics of using GitHub in Visual Studio: how to get the latest code for this game, and how to create your own GitHub repository for version control of your programs or to share your program with other programmers.

I’m going to show how to do this using Visual Studio 2019.

NOTE: If you’re using Visual Studio 2022, there is a different way to install Git, instead of using the “Extensions”. Run Visual Studio Installer, click the “Modify” button, select the “Individual Components” tab and search for “Git for Windows”. If it isn’t checked, you can check it then click on the “Install” button in the lower-right of the installer app.

You can install Git for the command line, or download the GitHub Desktop app from, although I won’t use those tools in this video.

Cloning a project from GitHub

When you’d like to get some code from GitHub, you can “clone” the repository – make your own copy of it.

Find the repository in GitHub and click on the “Clone or download” button.

Copy the URL listed for the repository. The URL for the SOSCSRPG project is:

Open Visual Studio 2019 and click on “Clone or check out code”.

Paste in the URL to the GitHub repository and select the folder you want to clone the source code to on your computer. The folder must be empty.

Click on the “Clone” button and Visual Studio will pull down the source code and open the solution.

Now you can start working on your copy of the program.

Upload your own project to GitHub

Now, let’s upload a new project to GitHub. For this example, I created a test project named GitHubDemo.

First, install the GitHub extension. From Visual Studio’s menu, select Extensions -> Manage Extensions – Search for (and install) GitHub Extension for Visual Studio

Next, in Visual Studio 2019’s menu, select Tools -> Options -> Source Control -> Select “Git”.

In the lower-right corner of Visual Studio, click the “Add to Source Control” message and select “Git”.

In the Team Explorer, click on “Publish to GitHub”.

Enter your GitHub username and password, then click “Sign in”.

In Team Explorer, you can enter a description for the solution (or leave it blank) and decide if you want to make your repository public or private (by checking the “Private Repository” checkbox).

When you’re ready, click the “Publish” button.

After a few seconds, you should see a “Repository created successfully” message.

Go to your “Repositories” page on GitHub and you should see the new repository.

NOTE: Before you add anything to a repository, make sure you don’t have any files that contain user IDs, passwords, or any other information you want to keep private.

You can do more with GitHub, and many people prefer the command line over the Visual Studio plugin. But this should get you started.

Plus, you can now share your code with me, if you ever have a problem with your version of the program and want me to look at it.

To see more about what you can do with Git, especially if you want to use the command line, check out:

NEXT LESSON: Lesson 16.1: Adding centralized messaging

PREVIOUS LESSON: Lesson 15.3: Building a “functional” inventory class


  1. Tristan
    Tristan 2024-04-06

    It won’t let me set my source control to github so I cant use my version of SOSCSRPG, do you know how I could fix that? Every time I try to switch my source control for the solution from visualsvn to git, it closes the solution and when I reopen it, the source control is back to visualsvn.

      SOSCSRPG 2024-04-08

      A couple things you can try (probably after backing up your solution directory to a safe location) are to:

      1. Remove the VisualSVN extension (in the top menu of Visual Studio, “Extensions” -> “Manage Extensions…” -> “Installed”, then click the “Uninstall” button) This may tell you it need to shut down Visual Studio to complete the uninstall. That’s OK.
      2. Shut down Visual Studio and uninstall TortoiseSVN from Windows
      3. In your solution directory, delete the “.svn” directory”
      4. Restart Visual Studio

      Please let me know if that doesn’t work.

Leave a Reply

Your email address will not be published. Required fields are marked *