Ready, Set, GIT!
Part III — Save Git for Later
This article covers the creation and setup of a Git repository on both GitHub and on your local computer. I will address how we then link the two of them together so that when we make changes in one, we can reflect those changes in the other one.

I will be assuming that you are working with UnityHub as your development platform on your local machine, although you could be using any other development platform using an Integrated Development Environment (IDE) of your choice.
The first step is to create a project that will be the base for your development efforts. For the sake of this article, we will create a Unity project using UnityHub in a file directory we have pre-allocated and named (i.e. UnityProjects on our desktop). This folder will be used for all of our Unity projects going forward.

Now we will use UnityHub to create our new project…

Select the folder we just recently created to store our project source code and resources.

Press the “CREATE” button and Unity will create the new base project.

Once the project is created, you will see the new Unity project that we just created.

Close the new project and then we will navigate to our UnityProjects folder to continue.

Open GitHub in your browser and sign-in (www.github.com/login).

Create a new Git Repository by clicking the New button (circled in the following screenshot.

Give the new repository a name appropriate for your project. Set it to “Public” for the purpose of sharing it with others or “Private” for designating it for yourself and other team members. (We show it as “Public” here for the purpose of sharing it with our development group). Then add a “.gitignore” option specifying “Unity” from the dropdown list options. And finally, click on the “Create Repository” button.

A new GitHub repository will be created shortly and open to the following screen.

Now we have to link this central repository to our local machine’s project.
Click on the Code button and then click the “Copy to Clipboard” option that is pointed at by the red arrow. This will enable us to paste it later when we link this repository to our local version of the repository.

Open the GitHub Desktop application on your local machine.

Click on the “Create a new Repository on your hard drive…”. Then fill in the Name using the same name as the one you used on the central GitHub master website. Then “Choose…” the directory where you initialized your original Unity project. Finally, click the “Create repository” button.

After a relatively short period of time, the repository will be created and the following screen will be displayed.

Start up Git Bash and navigate to the new repository on our local machine.

Now we need to connect the central GitHub repository with our local repository using the following command:
git remote add origin <URL>
where we paste in our original URL that we copied earlier into our clipboard, then press the enter key.

NOTE: You may be prompted to login to GitHub again for security verification purposes.
At this time, we can verify our two repositories are connected correctly by entering the following git command:
git remote -v
You should see the following response after pressing the enter key.

The 2 lines which are displayed show the origin name as the remote URL we pasted into the previous command to link the repositories as well as to show the available actions (fetch and push).
Congratulations! You have successfully linked your new repositories!
Next, we will look at “Part IV — Check Git Out!” where I will cover the process of maintaining a Git repository through the provided options of Git Bash, the command line interface to GitHub, that we began discussing in this article.