A Guide to Creating a Github Repository

Rayaan Siddiqi
The Startup
Published in
4 min readMay 6, 2020

--

Have you started to notice how the tens of projects you have made ranging from standard web applications to published apps on the app store are starting to become a cluster and very disorganized on your machine. Many developers, including myself, reach this point after they have begun diving into the world of Computer Science, and there comes a point where you need to organize those projects!

Overview

Github is one of the best platforms to manage those projects and has a lot of functionality, today I am going to take you through one of its feature many developers utilize, that being creating a repository and adding/saving your project files to it.

Note: Although there are multiple ways to create a repository and add files to it such as through Github Desktop, I will be explaining how to create a repository through the Command Line on Mac!

Install Git to the Terminal (Pre-Requiste)

Firstly, make sure that Git is installed on your terminal. This allows you to use the Git commands!

  1. Open the Terminal App on your Mac
  2. Type the following command into the Terminal

git --version

If Git was not previously installed, you will be prompted to install it.

Install Git Command

Follow the steps, download, and you're ready to get started!

Note: If you are having trouble with the installation, click here to directly download it through the download manager.

Create a Github Repository

Once you have installed ‘git’ to your terminal, we can get started by creating a repository, which is the place where your project will be stored.

To get started:

  1. Go to Github
  2. Click the “+” sign at the top right and click “New Repository”
  3. Add the name of your project, along with a description.
  4. Choose whether or not you want the Repository to be visible to others (Public Option) or just visible to you (Private Option)
  5. I recommend initializing the repository with a README file

Note: The README File is where you can add notes/details about your project

Creating a New Repository

Clone the Repository

After we have created a repository, we have to clone the repository to our computer to be able to add our project files.

  1. Open the Repository which you just created
  2. Click the green button “Clone or Download”
  3. Copy the URL
Clone the Repository by Copying the URL

Once you have copied the URL:

  1. Open the Terminal App
  2. Type the following command into the Terminal

git clone https://github.com/YourUserName/YourRepositoryName

Run the ‘git clone’ Command

We have now created a local copy of the Github Repository on our computer now!

Adding/Saving Files to the Repository

Once we have the local repository on our machine, we can add our project files to the Folder we just cloned. For example, say you were working on a web application, take the contents of the application and paste them inside the New Repository Folder.

Before we learn how to update the Repository, let me go over some important commands.

  1. git status

This command shows you all files which have been added, deleted, or changed.

2. git add.

This command stages the files which you have changed. It gets the files which will be updated on the Repository ready

3. git commit -m "Enter a message here"

One of the most important git commands! Furthermore, you can add a message describing the changes/additions you made for organization purposes.

4. git push

This commands actually saves/updates your files to your Github repository so that you can check the changes on Github.

Note: The first time you push, you may need to use git push origin master. This is to make sure that your local repository and Github repository are connected.

Quick Recap To Make Changes/Additions:

  1. git add. Don’t Forget the Period at the end!
  2. git commit -m "Message describing changes/additions"
  3. git push origin master

Conclusion

There we go, it was that easy to add your project to Github. You can now repeat this process for any of your future projects, and will be able to stay organized!

Remember, this is only one of Github’s many features. Want to learn more about the other features? Follow me on Medium to stay updated!

Thanks for reading my first Medium Article! I hope that you learned something interesting and will use what I talked about to your advantage!

--

--

Rayaan Siddiqi
The Startup

Student, Programmer, Producer, Editor, Leader. Always learning! Website: rayaansiddiqi.com