What’s a repository?
Before we get to creating a remote repository, let’s clarify the terminology. When you use version control, you create a repository to store all of the information about your project files and what changes took place over time. Not only does a repository contain historical versions of your project, but it also contains any alternate versions or branches of your project (more to come on this in a future article).
Why create a remote repository
Much like when you save a copy of your files to a secondary hard drive or an online server, you can create a remote repository to backup your version control data. In addition to backing up your project history, you also can use a remote repository as a central hub for collaboration. With your project hosted remotely, multiple contributors can download your repository to their local machines, make changes and then upload those changes to the remote repository for all contributors to access and build on.
There are multiple sites that can host your remote repository for free, but today we’ll look at getting started with GitHub.
Create a GitHub account
Open GitHub.com and enter your e-mail address in the box provided. Once you click “Sign Up for GitHub”, you will prompted to provide additional information to create your account.
When deciding on a username, keep in mind that it will be very visible as all of your repositories will be preceded by your username.
Once you confirm your humanity with the puzzle and click Create Account, GitHub will ask you a few questions about your history, interests and industry to customize your experience with their site. When prompted, follow the instructions provided to verify your e-mail address and complete your GitHub account.
Create a remote repository
Once you’ve completed your account creation, open GitHub.com and click Create Repository. If you have created a repository on GitHub before, you can click New to create a new repository, as seen below.
In either case, you’ll come to the following form to set up your repository.
Here you can provide a name and a brief description for your repository and and select who can see your repository. One important step to note here when creating a remote repository to use with Unity: check the box to Add .gitignore and choose the Unity template from the dropdown. Then click Create Repository to finish.
What’s a .gitignore file?
For curious minds like me, let’s take a moment to expand on .gitignore files.
The .gitignore file is a text file Git checks to determine if a file should be tracked for changes. When using a program like Unity, there are additional files included in your project to make Unity work correctly, but these do not always need to be included in your repository as they would be created and managed by the Unity software on any local machine. For example, Unity will maintain .vs cache files to interact with Visual Studio, but these files do not need to be included in your repository. GitHub provides a pre-formatted Unity template listing a variety of files and directories that can be ignored to reduce the size of your Unity project repository.
Now that we can create a remote repository, tune in next time for more on installing Unity.