Managing your first repository with Git — On the path to Unity development

Matthew Bartosh
3 min readApr 15, 2021

We’re going to start out with a brief overview of Git and navigating around within Git itself, then cover how to link your first repository and manage it from Git.

When you first open up Git Bash, you’ll see the following command prompt.

This is how we interact with Git and your repository. You’ll see at the top Git’s ‘current location’, my user folder. By using ‘ls’ you’ll ‘list’ all the available folders to change into and files that are present within your current folder.

In order to change folders, you’ll need to use ‘cd’, to ‘change directory’. I want to navigate to my Desktop, and in order to save some time, I can use the Tab key to auto-fill based of what I’ve already typed.

cd desk (‘tab’) — gives me

You’ll notice the next line has quotes around it. The command prompt doesn’t recognize spaces (as it believes that to be an additional command or modifier), meaning if a destination folder or file has a space in the name you’ll either need to put quotes around it, or use the syntax

cd Version/ Control

with a \ before each space for Git to recognize it, as in the last line. (This is also how the Tab shortcut will handle spaces in your destination folder.)

If you already know what your destination is (in this case, the Version Control folder where we’re going to be linking our repository), you can also simply navigate to the folder, right-click, and select the shortcut ‘Git Bash Here’.

From here, we’ll use ‘git init’ to initialize a Git repository within this folder, then go to GitHub to grab the link for the repository we’d made in the website in order to link the two. Click the green ‘Code’ button on the top right, then copy the link given under the HTTPS option.

Finally, we’ll use the command

git (because all git commands start with this) remote add origin (origin is the industry standard for the main/master server name) [GitHub URL]

at the end of the command, paste the URL you got from GitHub into the command… To verify it all works, you can use the command ‘git remote -v’ to ensure you have permission to push and fetch from the origin. When you use these commands, you might be prompted to login to GitHub, if it did, verify yourself by doing so.

Here’s the whole process. As you can see, the remote already existed for me, so I got an error, but you won’t have to worry about that for your first time.
Unlisted

--

--