Lets us save our precious Unity Projects in our GitHub account using Git
This article thinks you already have a Unity project on your drive. If you don’t have a Unity project, create one to have it stored on your GitHub account
What We Need
Locate the git file, double-click to run the program or right-click and select open and follow the installation instructions.
Sign Up To Get A GitHub Account
Create Your Repository
Inside your GitHub account, go to the section Repository and click on New
Fill out the following fields
Write the Repository Name, and if you like a small Description that is optional
The name on the repository does not need to be the same as the one from your Unity Project. It is advised that both your repository and your Unity Project share the same name
Select Public.
A Public repository can be shared by just sending the link; the Private repository can only be accessed if the owner permits the user on the security section found in the setting of the Repository
In the Add .gitignore section press on the .gitignore template and select Unity
Now Create Repository
Got to the Code window(Green Square with Code writing on it) and copy your git repository URL address
Initiate Git In Your Unity Project That Will Be Store On Git Hub
Find your desired Unity project; mine is located on the Desktop and is called Unity_VR. Open the Unity project folder, right-click in a space inside the folder, and select Git Bash Here
Git will open directly to the root of your Unity project.
Inside the Git Terminal, type git init . and press Enter; yes, there is a space between init, and the period(.) You would know that it has been initialized when you see a new folder called .git.
Linking Github to Local Project
Once your project is initialized, type on the Git Terminal “git remote add origin #gitURL#”, and press enter.
Remember that the #gitURL# is the git repository URL address we copy on the Create Repository section
To see if is running correctly, type on the terminal git remote -v . You need to have (fetch) and (push) as you see on the image.
Before uploading our project to GitHub we must first make a PULL to get our .gitignore file into our Unity project. On the terminal type git pull origin master, press enter. You will see the file .gitignore is added to your project.
git add . And Our First Commit
To add our files to GitHub we first must add our files to git. Back to the terminal type git add . , press Enter. Lots of line will appear and depending on the size of your project this can take time.
Now let make your first commit, type git commit -m “write your message between the quotation marks”, press Enter. This can also take some time.
Push Our Project To GitHub
Type git push -u origin master and press Enter to upload your project to GitHub
Refresh your GitHub Repository and you will see your Unity Project uploaded on the repository
This is a fast guide to link your Unity project to a repository on GitHub.
To make a fast note, my repository's initial branch will always be named Master, and your can be named Main; everything in this article will work the same. Change to main when you see the master keyword.
I will add my personal Git Basic Commands Cheat Sheets
TO BE CONTINUED 😎