Reading time: 5 minutes
In this post I will explain how to create a repository using Sourcetree and upload it to GitHub. As part of this process I will also create a Net Core Web App that would be committed to a remote GitHub repository.
What is required
- GitHub Account
- Visual Studio
- Sourcetree GUI for Git
Let’s start by creating a local repository using Sourcetree
Open Sourcetree and add new tab. On new tab click on Create.
On the next screen we should specify where to create a folder that will hold the repository files. Also an important bit is to tick Create Repository On Account. This way we are creating a connection between your local repository and remote repository that will be created after you confirm details by clicking Create.
If you got to your GitHub account you should see the newly created repository.
You can see that the repository folder together with the Git folder have been created at the location you previously specified.
Next step is to open Visual Studio and create a Net Core Web App.
Make sure you use the app name we used to Create repository since Git is tracking that location.
If you go to the location where you placed your repository. You should see the next picture.
Moreover Git tracked these changes. If you go to Sourcetree this is what you should see.
So let’s click on Stage All, add a commit message and click Commit.
Next step is to push your local changes to remote repository.
And if you got to GitHub again you would see all these changes.
Git is a distributed version control system. In order to become an efficient software engineer/developer you need to understand how it works. This way you can track your changes, always have a copy at a remote location. Which is useful if you need to share this repository with a peer engineer or in case you have lost your local machine copy.
As long as you have initiated the repository you are all set up with version control. Then it’s a case of personal preference. Instead of remembering the location of the repository folder on your machine for creation of the application using Visual Studio. You can simply create an application at one local location and copy over to the folder where you established the repository.