How to upload a new project into a new github repository

How to upload a new project into a new github repository

github commands

Today I’m going to show you some basic commands that can be used to upload our working project into a new repository on GitHub. Because of GitHub becomes a very popular version controlling system, I thought it may be very useful to you.

Basic commands

  1. git clone repository URL
  2. git status
  3. git add .
  4. git commit –m “message”
  5. git push

Now we look at what is done by each command.

  1. git clone repository URL – This command copies the existing repository.
  2. git status – Displays the state of the working directory and the staging area.
  3. git add . – Adds changes in the working directory to the staging area.
  4. git commit- Save your changes to the local repository.
  5. git push – Upload local repository content to a remote repository.

 

So, Now we look at how to add a project to a GitHub. So, the first login to your GitHub account and create a new repository. Then copy the URL of the repository.

Create a new repository in GitHub

copy clone URL of the GitHub project

Clone a new git repository

Then go back to your working folder and open git bash (or command window). After opening the git bash run command, git clone ‘URL’ of the repository’.

clone the git project into local machine

clone the git project into the local machine

It will create creates a copy of the GitHub repository.

Find status of the working directory

Then,  go to the newly created folder and put your workings here. As an example, I create a simple text file. Then, open GitBash in the new folder and run command, ‘git status’. It will show the current state of the working directory.

"run

 

Add changes to the staging area

Then, run ‘git add .’ and it adds changes in the working directory to the staging area.

"run

Commit to GitHub

After adding changes into working directory run, git commit –m “message”. Also, You can write any thing as the message.

git commit with a message

git commit with a message

So, it It will save changes to the local repository.

Push to GitHub

Finally, run git push.

"run

Git push command will upload local repository content to the remote repository. Okay, now your project is in the GitHub. Run last four commands after completing each version of your project. It will upload each version of your project to GitHub.

You will meet a lot of git commands when you controlling versions of your projects with GitHub. But in this case, my objective was teaching very basics commands that can be used to start working with GitHub. Thanks for reading.

Please follow and like us: