How to set up GitHub with Unity using GitHub Desktop

Link a Unity project to GitHub so your work is backed up and versioned. You will create a repository, clone it, add a Unity project and make your first commit and branch. It suits beginners who have Unity installed and want a simple desktop workflow.

YouTube video: How to Setup Github with Unity the Right Way

Caption availability is unknown. Check the CC control in the YouTube player.

10 chapters. Tap a step to jump to it.Chapters from the creator
Choose a chapter (10)
Video length
7 min 1 s
Time to do it
20 minutes
Difficulty
Easy
Steps
8

What you need

Steps

  1. Create a free account at github.com, then download and install GitHub Desktop from desktop.github.com. Sign in to the app with your new account.

  2. In GitHub Desktop, click File, then New repository. Give it a name, choose a local folder, tick the box to add a README, and click Create repository.

  3. Publish the repository to GitHub by clicking Publish repository. Untick Keep this code private only if you want it public, then confirm.

  4. Open Unity Hub and create a new 2D or 3D project inside the folder you cloned. Keep the project files in that same folder so Git can track them.

  5. Switch back to GitHub Desktop. It lists the new Unity files as changes. Add a short summary in the bottom left box and click Commit to main.

  6. Click the Current Branch menu, then New branch. Name it something like first-feature and create it. Make your Unity edits on this branch.

  7. Commit your changes on the branch, then click Create pull request or merge the branch into main using the Branch menu.

  8. To throw away unwanted edits, right-click the changed file in GitHub Desktop and choose Discard changes. Confirm when asked.

Tips and common mistakes

Add a Unity.gitignore file so the Library and Temp folders are not committed.

Commit small changes often with clear messages instead of one huge commit.

Pull from GitHub before you start working each day to avoid merge conflicts.

Questions

Do I need to know Git commands?

No. GitHub Desktop handles cloning, committing, branching and merging with buttons, so you can skip the terminal.

Will my Unity project files be uploaded?

Yes, the files inside the repository folder are tracked. Keep the Unity project inside that folder and add a.gitignore to skip large generated folders.

Can I undo a commit?

You can discard uncommitted changes in GitHub Desktop. To undo a commit, use the History tab and revert it.

The notes are drafted automatically from video details and general task knowledge. How the guide was prepared

Report a correction

More in Apps & Software

See all