How to Create Your first Github Project [Step by Step]

By: Sunil Kumar |  In: Git  |  Last Updated: 2019/04/21

Github is the first choice when people think about creating an open source project and want to share it with the public.

Github is also useful if you are developing a project and looking for a remote server to keep your project(you can create a private repository on GitHub).

So in this guide, we will be creating our first repository on GitHub and linking it with your local system to push and fetch the files from your local system.

So for this first thing, you need to have a GitHub account. Create a GitHub account and login into your account.

When creating the account choose free or pro account based on your requirement. I recommend free account when you are starting with GitHub. You can upgrade later if you need to.

After you created a GitHub account and login to it you will see a screen to create your first project. click on the “Start a project”.

Now fill the basic information about your project like the name of the project, description, you want to keep the project private or public, etc.

create-new-github-repository

Now you will be redirected to your project page where you will see all the files(no files as a newly created project) and other information.

How to install Git and start Working on your first project

Pushing branch from your local system

When you are working on a project, most of the time you will be working on your local repository and committing to the GitHub repository.

In this section, you will be understanding this workflow by creating a project on your local and pushing the changes to the GitHub repository.

So open the terminal and create an empty repository and initialize git on it.

mkdir project
cd  project
git init

Create a README.txt file in this directory and commit the changes.

Till now we haven’t told our git repository to which GitHub repository it should be communicating to. To do this, copy the repository path from GitHub and add a remote.

git remote add origin https://github.com/readershook/first-project.git

We have added remote but still, we will not be able to communicate with GitHub as we have not authorized to do this.

To allow connection between your local system and GitHub you need to add your systems public ssh key to the GitHub account.

To access your public SSH key run the following command on your terminal

cat ~/.ssh/id_rsa.pub

if you don’t have an SSH key created on your system you can create using this guide.

copy this SSH key and add it to your GitHub account(Setting > SSH and CPG Keys > New SSH Key).

add-new-ssh-key-github

After adding SSH Key you can easily push and pull the branch from your local system to Github.

Commit all your changes on local repository and push the changes to GitHub.

git commit -am "first README.txt change"
git push origin master

To check everything went smoothly head over to your GitHub repository and you will find your changes there.

In case you find difficulties comment below and let me know. I will be happy to help

 

Comments


Leave a Comment

Your email address will not be published.

*


Sunil Kumar


I am the owner of acmeextension. I am a passionate writter and reader. I like writting technical stuff and simplifying complex stuff.
Know More

Join more than 10,000 others Web Developers


%d bloggers like this: