A Guide to Creating a Github Repository

Rayaan Siddiqi
May 6 · 4 min read

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.

Image for post
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

Image for post
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
Image for post
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

Image for post
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!

The Startup

Medium's largest active publication, followed by +718K people. Follow to join our community.

Rayaan Siddiqi

Written by

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

The Startup

Medium's largest active publication, followed by +718K people. Follow to join our community.

Rayaan Siddiqi

Written by

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

The Startup

Medium's largest active publication, followed by +718K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store