GitHub — A beginner’s Guide For The Linux.

Subhan khaliq
5 min readNov 15, 2020

GitHub is a platform for code hosting that lets you to collaborate and work together with your friends in different projects. To understand GitHub you must have the knowledge of “GIT”. Git is basically a open source version control system, it means when developers create an app or any other project, they make constant changes to the code and build new versions. Version control system helps them to keep these changes and storing the modifications in a central repository.

Why we need GitHub ?

We need GitHub because it is like a cloud for code. We can also use it as a showcase for our work. Because most companies look into the GitHub profiles when they are searching new recruits for their projects. We can also make constant changes in our code in different projects and GitHub keep storing these changes for us.

How to create an account on GitHub ?

First of all you need to go on GitHub website using the link given below

Now, Go to sign up option and fill the create account page. Make sure you gave a valid email. Then, go to create account. You’ve successfully created your account.

Enter your unique username, a valid email and password to verify

What is repository ?

Repository means “A central location in which data is stored and managed”. In GitHub repository is a folder for your project. It contains all the files of your project. You can also make changes to your files.

How to create a new repository ?

To create a new repository go to up right corner and click on ‘+’ logo. Then chose the option of New repository.

Click on New repository

Then name the repository, give description if you want but it is suggested that you should give description because it helps others to understand your project. Then make it private/public it’s all up to you. Click on create repository. You’ve successfully created your repository.

How to Push your files to your repository ?

Step 1

First of all on your terminal enter to the directory where your project is stored. Now run following commands to push your project into the repository.

git init

Step 2

Now run the command to add file you want to add. If you want to add specific file you have to gave name of that file. I want to push all my files, so I use ‘git add .’ command.

git add .

Step 3

Now run command to commit means changing your file. Every time you do changes in your file you have to commit and add some meaningful comment.

git commit -m "first commit"

Step 4

Now if you want to add branch in the repository. Branch in GitHub uses to create another branch of repository. Because in this you can make constant changes in the code and then you can merge it with the main code.

git branch -M main

Step 5

Now run command to connect your local directory to the repository on which you want to push your Project. You can also give a unique user name in the command. I have used URL in this command.

git remote add origin https://github.com/Subhan-khaliq/Dummy.git

Step 6

Now push your files into the repository.

git push -u origin main

There it is you’ve successfully push your project. You can also add ‘read me’ file where you can add ‘how-to’ information about your project.

How to upload files on your repository ?

It’s another way to add your files by uploading it directly on repository.

Step 1

First of all open your repository and go to add file option and choose upload files.

Step 2

I’ve upload file with the name “inheritance.java”. Now, commit this file and give comment to this commit. Then choose option for commit to main branch or create another branch. I’ve choose commit to main branch. Then press commit changes button.

You’ve successfully upload file directly without terminal.

How to clone a repository ?

Clone creates a local copy of your repository. By this you can easily edit your changes locally rather than on the source files of your repository.

Step 1

Go to up right corner and press the code option. Then copy the URL and open the terminal. Go to the directory where you want to clone. I’ve given the URL of my repository.

If you don’t want to use terminal you can also download the zip file by pressing Download ZIP option.

Now, run the following command to clone your repository.

git clone https://github.com/Subhan-khaliq/Dummy.git

You’ve successfully Push and Clone your repository using Terminal and by directly on your repository.

--

--

Subhan khaliq

I am an Associate Software Engineer and love to write tech blogs