New Unity Project and Repository

Lana Elfstrom
3 min readOct 20, 2022

--

Download Unity and Unity Hub to create a new Unity project.

When installing Unity use the 2019.1 or later version. Hub is a tool which allows management of downloaded Unity versions through the editor. The “New” button with dropdown of versions is in the projects tab. Choose most recent version and create a location for all Unity Projects. Choose the template and click “Create” to compile a new Unity project.

Next step is to log into Github. Create a new repository, using same name as the new project. Choose whether repository will be “private” or “public”, along with optional Readme file initialization. If it is a team project, add GitIgnore file to prevent collaboration of certain files by Unity. Once you’ve created the repository, it will be listed on the left side.

Git terminal will show current directory location at the top. Use navigation commands to open location of the project file in Git. The terminal does not read spaces, nor is it case sensitive.

These are a few basic navigational commands to know:

ls — everything in current directory

cd — change directory to a specified folder

To link Github to the local project, open Github and copy the url shown for Clone or Download. Go back into Git. When you are in the project file, right click and choose Gitbash to open the console.

Git init

-command initializes a Git Repository in the project and the server is added to the repository.

$git remote add origin (paste the copied url)

-indicates communication with a remote server and provides the url, automatically adding the origin to the local project.

$git remote -v

-verifies the successful connection to origin server with permission to fetch and push to the origin, as well as create and pull commits.

There is an important order of commands to remember for all commits:

1. PULL from server

2. COMMIT

3. PUSH

Git pull origin main

-main is the branch to merge with.

Git branch

-shows current branch

Git add .

-adds all the untracked files

Git commit -m “brief explanation/comment

-puts all the folders into a commit

Git push origin main

Git branch

-will list branches

Git switch dev

-switches to that branch

Source code is now on github you can refresh to see it.

COMMIT OFTEN!

--

--