How to upload your code in Git

If you don’t have git installed, see the below article on how to set it up.

Once it is setup , follow the below steps to upload the code to Git !!

  1. Go to Start –> Search for “Git” and click on “Git Shell” which opens up a Windows command prompt.
  2. Change into the directory where your source code is located in the command prompt.
  3. First, create a new repository in this directory

    git init

    This will say “Initialized empty git repository in ….git” (... is the path).

  4. Now you need to tell git about your files by adding them to your repository. Do this with

    git add <filename> 

    If you want to add all your files, you can do

    git add 

  5. Now that you have added your files and made your changes, you need to commit your changes so git can track them. Type

    git commit -m "<comments :adding files>"

    -m lets you add the commit message in line.

So far, the above steps is what you would do even if you were not using github. They are the normal steps to start a git repository. Remember that git is distributed (decentralized), means you don’t need to have a “central server” (or even a network connection), to use git.

Now you want to push the changes to your git repository hosted with github. To you this by telling git to add a remote location, and you do that with this command:

git remote add origin

Once you have done that, git now knows about your remote repository. You can then tell it to push (which is “upload”) your commited files:

git push -u origin master

References :




Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s