Setting Up Your Project with GitHub Desktop

FJ Hagen
3 min readAug 16, 2021

--

Having one’s computer crash and losing all their work is the worst nightmare scenario for any developer. Luckily, there’s a way to prevent losing work in the event of a crash: version control. Version control allows developers to keep track of changes to their projects over time. It also makes it easy to retrieve an existing project and work on it from another computer. As a Unity Developer, I use GitHub Desktop for version control. Now, I’ll show you how I set up a Unity project with GitHub Desktop.

First, go to GitHub and create a new repository. Give it whatever name you want and add a description if you like. The important part here is the .gitignore file. Click the “Add .gitignore” checkbox, and a dropdown will appear. Choose the Unity template. This template tells Git to ignore certain files so each commit won’t be thousands of files large.

Now go to GitHub Desktop and click on File > Clone Repository. Navigate to the repo you created, and click Clone.

I already cloned this repo.

Open Unity Hub and click on the blue “New” button. In the project window, select the 3D template. The important part here is to save it in the same folder where you cloned your repo.

In a couple of minutes, your project will be ready. At first, there will be thousands of changed files listed on GitHub Desktop.

What happened to .gitignore?

That’s because the .gitignore file is not in the right place. If you go to the repo folder, you’ll notice that the .gitignore file is separate from the Unity project. Move the file to the folder where your Unity project is. Now, there will be far fewer files since .gitignore is now telling Git to ignore all the extra ones.

Lastly, you can now commit your changes. Add a summary to your commit and click “Commit to main.” Then, click the button that says “Push origin.” Now, your project is safe and viewable on GitHub. I’ll show the process in this gif:

Now you have a project that’s hooked up to version control and ready to be worked on. Happy developing!

--

--