Linking a github repository to your local machine using Gitbash

Rhett Haynes
3 min readApr 25, 2021

--

Now it’s time to link our github repository to the project on our local computer using an application called gitbash. Gitbash is installed to provide an emulation layer for a Git command line experience.

To start, install gitbash from https://git-scm.com . When that is complete, open gitbash and leave it open.

Next, open the Unity editor to either open or create a new project that you will be working on. Keep the project open or minimized to help with linking this project that you will be working on.

Then, head to the project location you will be working on. There is two ways to connect to the project location:

  • Use the “ls” command to list the directories active on your machine. When you see the directory that you need to navigate to, use the “cd” command which stands for “change directory” and the name of the directory to change to that directory until you find your project (ex. cd Desktop/). Type the directory first couple of letters, and use the TAB shortcut to fill in the rest of the directory’s name. If your directory’s name has 2 or more words in it, inside quotations either type the name of the directory, or type a part of the directory’s name and press TAB to autofill the rest of the directory’s name.
  • The other way is to use the explorer to navigate and find your project file’s location. Once you find the project file, open the folder and inside that folder right click to find “Git Bash here” in the menu. When you click on it, you will be taken to the project’s file location automatically inside of gitbash.

Once you’re inside the project’s directory, initialize the location of the project for github using the “git init” command. After the initialization, set up path to the repository by going back to your github page and make sure the project you’re working on is open. Click on the “Code” button, and copy the url address under HTTPS.

Go back to gitbash to add the server you will be connecting to. The command to use is “git remote add origin url address that was copied from github”, and enter. To verify the server was added, use the command “git remote -v”. You should see that you’re allowed to fetch the origin or push to the origin.

Now the next step will be learning how to create a commit, and how to pull from the origin server.

--

--

Rhett Haynes
Rhett Haynes

Written by Rhett Haynes

Learning to become a Unity game developer.

No responses yet