Beginners Guide on how to upload/push a project to GitHub in 5 mins!

GitHub is a web-based hosting service for version control using git.

To understand GitHub, you must first have an understanding of Git.

Git is an open-source version control system. Git is similar to other version control systems—Subversion, CVS, and Mercurial.

Git was developed by Linus Torvalds and released in 2005 whereas GitHub was released in 2007.

This post will show you how to upload/push a project to GitHub in quick time.

Prerequisites:

  1. GitHub Account(Sign up here)
  2. Git installed in your PC(Download GIT here)
  3. A project to be pushed

Step 1) Open Git Bash

Once you have completed the prerequisites, open the git bash console by right click on your project.

w2

Step 2) Create a New Repository in GitHub

w3

Step 3) Enter the Project Repository Details like Name of repo, description etc as shown below.

w4

Click on Create Repository.

Step 4) Copy the git URL

w5

Step 5) Initialize your project with git

$git init

(reinitializes your local repo; also clearing remote repos (ie origin))

w1.PNG

Step 6) Add remote URL from GitHub Repo

$git remote add origin <url>

(will create ‘origin’ if it doesnt exist else, it’ll just change the existing ‘origin’ site.

w5

w6

Step 7) git-add – Add file contents to the index

w7

Step 8) Do your ‘first commit’

git-commit – Record changes to the repository

w8

Step 9) Push the the changes to repository

git-push – Update remote refs along with associated objects

w9

Step 10) Check back your repo in GitHub and there you have it!

w10

The above tutorial is very basic one on how to push a poject from commandline git.

In upcoming posts will share basic git commands and how to use them.

Hope it helps!

Share our views in the comment section.

PS: If the user name and password is not setp in git then below are the commands to setup:

Setting your Git username for every repository on your computer

  1. Open Git Bash.
  2. Set a Git username:
    git config --global user.name "The Web Spark"
    
  3. Confirm that you have set the Git username correctly:
    git config --global user.name
    The Web Spark
    

Setting your Git username for a single repository

  1. Open Git Bash.
  2. Change the current working directory to the local repository where you want to configure the name that is associated with your Git commits.
  3. Set a Git username:
    git config user.name "The Web Spark"
    
  4. Confirm that you have set the Git username correctly:
    git config user.name
    The Web Spark

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s