smooth camera follow script

Git version control for Unity using Bitbucket and Sourcetree

Git version control for Unity

Welcome to this easy and quick tutorial how to set up Git version control for the unity game engine.

Using Bitbucket and SourceTree

Making things easy, we use Bitbucket for online repositorys and the sourcetree-app to do commits, pulls and pushes.

Make shure to watch the following video, where I teach everything about setting up version control.
After that, don’t forget to set up your gitignore-file for SourceTree, check out the screenshot and description below.



Afterwards don’t forget to include a “gitignore”-file in your project directory.
That way you can make shure that only the necessary files will be uploaded to the remote repository.
All the crap stuff like temp- and build-files etc. will be ignored.

You can create the file by creating a new textfile, using filename “gitignore.txt”.

Copy and paste the following content into the file and save it:

# =============== #
# Unity generated #
# =============== #

# ===================================== #
# Visual Studio / MonoDevelop generated #
# ===================================== #

# ============ #
# OS generated #
# ============ #


Than rename the file and delete the “.txt”-fileending. There you have your gitignore-file:


Since SourceTree uses its own gitignore-file, you have to tell SourceTree to use your gitignore-file.
SourceeTree -> Tools -> Options -> Git shows the git ignore file location it uses. You can also edit the file from a button in that dialog.


SourceTree set up gitignore file



  1. Hi Tobi – I have played around with the .gitignore but there are some files in Library that won’t ignore. Most of them are in the Library/Metada folder, but there are some other ones and it is ignoring most of the files in Library. Do you know why this might be happening? Thanks in advance!

    1. Hi Nahele,
      sorry for answering that late.
      If you talk about the .meta-files, they have to be included. Unity creates them for each asset, in order to identify the asset in the unity editor.
      If an asset loses its meta file (for example, if you moved or renamed the asset outside of Unity, without moving/renaming the corresponding .meta file), any reference to that asset will be broken.
      For more information you can read this official unity documentation:

      The Library folder should not be included in version control. Let me do some research, why it is included with this gitignore-file.
      According to the syntax of the file, the path “Library/” should be ignored.

    2. Hey there Nahele,
      here comes the solution: SourceTree uses its own gitignore file. The menu “SourceeTree -> Tools -> Options -> Git” shows the git ignore file location it uses.
      You can choose and edit your gitingnore-file from a button in that dialog.
      Here is a picture of that:

      SourceTree set up gitignore file

      However also important to know: git will continue to track any files that are already being tracked in your project.
      So you have to select the /Library/-files and select right mouse button -> stop tracking.
      After doing a commit, they are not tracked in the git-repository anymore.

  2. Thank you Tobi, your tutorial has been a great guide to setup the versioning of my Unity project.

Leave a Reply

Your email address will not be published. Required fields are marked *