# Backing Up Your Unity Project with Sourcetree and GitHub

In this guide, you'll learn how to create a local and remote repository for your Unity project using Sourcetree and GitHub.

## Prerequisites ##
* Make sure that your GitHub account is already linked with Sourcetree. 

## Creating a local repository
1. Launch Sourcetree and click **+** to open a new tab.
2. At the top of the tab, click **Create.**
![imageedit_1_3395027564.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632754765141/5ghVge9ff.png align="left")

3. On the **Create a repository** screen, click **Browse**.
![imageedit_1_5008856070.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632754876678/wiU7uXTaD.png align="left")

4. Select the top-level folder of your Unity project and click **Select Folder**. Your project details will now be displayed on the screen.
    
5. Click **Create** and wait for Sourcetree to create the repository. If you are notified that the destination path for the project already exists, click **Yes** to continue.
![imageedit_1_6721780616.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632754968517/Fa9khMNCa.png align="left")

6. Under **Unstaged Files**, select any singular file with the ```Library/``` path.
![imageedit_1_3816506400.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632755047106/Q1tcorCyE.png align="left")

7. Right-click the file and select **Ignore**.
    
8. In the **Ignore** dialog box, select **Ignore everything beneath: Library**. Click **OK**.
![imageedit_1_4333848295.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632755111304/TxLxayGFE.png align="left")

9. All files with the ```Library/``` path should now disappear from the Unstaged Files section. Select the ```.gitignore``` file and double-click to open it in a text editor such as Notepad.
    
10. Copy and paste the contents of the [.gitignore file for Unity](https://github.com/github/gitignore/blob/master/Unity.gitignore) into your local ```.gitignore``` file. Then **Save** and **Close** your file.
    
11. The Unstaged files section in Sourcetree should now reflect these changes and you’ll notice there are fewer files visible. Click **Stage All**.
    
12. Write a short commit message in the box at the bottom of the window. Click **Commit**.
![imageedit_1_8433307035.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632755216412/REuV0ifUN.png align="left")

*Congratulations! You will now see your commit logged in the main branch of your project in Sourcetree.*

## Creating a remote repository

1. While logged into your GitHub account in a browser, click **+** in the top-right corner of the screen. Select **New Repository**.
    
2. Enter in your project details and choose whether the repository will be public or private. Click **Create Repository**.
![imageedit_1_2883572285.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632755535011/s_Fg8cZby.png align="left")

3. On the next screen, copy the HTTPS URL.
![imageedit_1_4939481080.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632755585311/EEDFx4Cwv.png align="left")

4. With your project open in Sourcetree, go to **Repository > Add Remote**.
    
5. In the Repository Settings Dialog Box, click **Add**. Enter in a Remote Name and paste the URL you copied from GitHub into the URL/Path. Using the dropdown, select your GitHub account, then click **OK**.
![imageedit_1_8681158768.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632755696096/D1kIKeKgo.png align="left")

6. Click **OK** in the Repository Settings dialog box.
    
7. Back in the main Sourcetree window, click **Push** to open up the Push dialog box. Select the branch you want to Push and double-check that the remote repository details are correct.
![imageedit_1_3279658472.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632755834698/XF-DZc8Hx.png align="left")

8. Click **Push**.
![imageedit_1_7909618410.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632755925828/GB_TsPKJk.png align="left")

*Congratulations! You can now access your repository via your GitHub profile!*
