Using Github, Git and Github Desktop to Backup Projects

Unity has good collaboration tools, however by default Collaborate only keeps three months of versions.

Github allows us to create a repository for out projects.

However Unity creates a lot of unneeded files that we don’t want to back up.

The easiest way to manage Unity using Github is to use Github Desktop.

Software Required

You need to download the following (restart the computer after installing)

  • Unity (obviously)
  • Github Desktop
  • Git – This is a heavyweight version of version control
  • Visual Studio Code (or another editor)

Creating the Repository

We need to setup an empty repository in Github (We will copy or move our Unity Project into this later).

Remember don’t make this folder on OneDrive or another cloud drive.

Open Github Desktop

Create a new repository File > New repository…

Give the repository a name (this folder will be created)

In local path select the folder there the repository will be created.

In this example the folder of the repository will be:


And the Unity-UI-PlayerSpeed folder will be created and will contain our Unity project

We also need to set a Git ignore file and choose Unity to configure Github to ignore certain files and not back these up. These will be the logs and temporary files.

Click create repository.

We are nearly ready to move / create our Unity project.

However we want to configure the .gitignore file to ignore some additional files.

Click Show in Explorer or Open in Visual Studio Code

Open .gitignore in your editor

You should have a .gitignore that looks similar to this.

We need to modify it.

Add in Logs/ on line 7 and *.log on line 28. This will ignore the entire Logs folder and any files with the extension .log.

Save the file.


# Visual Studio cache directory

# Autogenerated VS/MD/Consulo solution and project files

# Unity3D generated meta files

# Unity3D Generated File On Crash Reports

# Builds

You should see the changes in Github Desktop, don’t commit and publish them yet.

Adding the Unity Project

You can now copy your Unity project into this folder or create a new Unity project.

Note if you try to create a project directly into the folder it will give you an error.

Make a project in a different folder initially and then close it.

We can see I have two folders.

We want to move the contents of the Unity Project into the github folder.

Go into the Unity Project folder (in this case Unity-UI-PlayerSpeed2)

Press Ctrl+A to select all and then Ctrl+X to cut the files.

Go to the github folder.

Paste the files here.

Delete the Unity project folder as we don’t need it anymore.

Open Unity Hub.

We need to remove the old project and Add the one in the Github folder.

Click the to the right of the project name.

Select Remove from list

Click Remove from list

Add Existing Github Project

Next click Add to add the folder of the Github Unity project.

Select the folder (go into the folder) and click Select Folder

You can now open and use Unity as normal.

However we need to publish and commit our project.

Committing changes to Github

Switch to Github Desktop

You should see a number of changes.

In the bottom left enter a summary and description of the changes

Click Commit to main

For the first commit you will be asked to Publish repository.

Click Publish repository

Choose the settings.

When you make additional changes Github Desktop will track them

Repeat the above processes

Now you have a Push origin button.

There is also one in the menu bar.

Viewing on Github, adding other users, and downloading copies

To view on Github click Repository > View on Github

You can now see your project.

By clicking on Code you can download a copy of the repository or link to Github desktop.

You would get others to Open with Github Desktop to share a project with others. They then add it as in the Add Existing Github Project section of this lesson.

Adding users to a private repository

If you are working with others you probably don’t want to share your code publically.

You need to add other users to your repository.

On in the repository, click Settings

Click Manage Access

Click Invite a collaborator

Enter the username or email of the person to add.

Click Add … to this repository

The user us now invited.

You can add additional users through Invite a collaborator

The user you invited will have to go to their email and accept the invitation.

Once they have, the pending invite will disappear and they will have access to your repository.