Uploading code to your github repository

Table of Contents:

    1. Creating gihub repository
    2. Upload your code
      • Using github Drag and drop feature
      • Using git VCS (version control system)


Step 1:

Visit github.com.


Step 2: 

Login (or) Signup to github


Step 3:

    Click on the new button to create a new repository


 


Step 4:

Enter any name in the repository name input field and click Create Repository.

Note: By default your repository would be public which means anyone on the internet can see your code.  You can also change it to private by choosing private radio button while creating your repository


Step 5: 

Now your repository has been created.  Lets add our code to it.  
There are two ways to upload your code to the github repository:

  1. Using drag and drop feature
  1. Using git VCS(version control system)


1. Using github drag and drop feature:

Note: Using github drag and drop feature is easy but it has limited features.  If you have to work on many updates on that project using the same local system then I suggest you to use the 2nd method of using git VCS to upload code to github.  However drag and drop feature would be very much easier for one time use.

If the above window appears in your repository's code section, click on "uploading an existing file" option. 

(or)
If the above window doesn't appears  then, click Add file -> Upload files 
Now you can see the window like this:


If the above window appears then open your File manager and select all the files/folders that has to be uploaded to github, then drag and drop in the window that appears as above.

After everything is uploaded you have to scroll to the bottom of the page and click Commit changes.

Hurray! now your code has been uploaded to github.


2. Using git VCS:

Pre-requisites: You should have installed git in your system before performing the below operations.  It can be downloaded from https://git-scm.com/downloads

After installing git check the installation using command git --version

After git has been installed globally in your system navigate to the project folder using command line.  Then execute the below commands:

Step 1: initializing git repository

git init 


Step 2: adds all files(staging)

git add . 


Step 3: committing the change

git commit -m "First commit"


Step 4: adding remote url

Copy your HTTPS remote url from the repository code section.



git remote add origin <repository url>

Note: In the above command <remote url> should be replaced with your unique remote URL that can be obtained from github repository code section as shown in the above image.


Step 5: upload code to remote

git push -u origin master


If it doesn't shows up any error then your code has been successfully uploaded to github

Comments