How to upload project to GitHub?

Hello Viewers, Today, In this article, we will know about how to upload your project or code or any other files to Github. Well, we can do this in two methods.

1. Adding your project or code via the github.com website.

2. Using Command line.

Here we will know both the methods and you can choose which is comfortable and best for you. So, let’s go.

Whatever the method you choose the first step you need to do is create an account in Github by visiting the github.com website or if you have one then no worries just login to your account.

#Method 1
   Step 1  

After login on the top right click on the plus(+) button and choose New repository, and you will be redirected to another page.

   Step 2  

Here you need to your repository details,

  • Fill the Repository name field with your project name or any name which you would like to keep.
  • Choose Public if you want it to visible everyone or you can choose private if you want it visible only to you.
  • The third section is completely optional you can choose if you want them to be in your newly created repository. its better if you check on add a README file, and click on create repository.

   Step 3  

A new repository is created, if you checked on add a README file while creating repository you will find a page something like below, if you see this then click on Add file and choose upload files, a new page is opened.

if you didn’t choose to add a README file while creating a repository you will find a page something like below if this screen comes up then click on Uploading an existing file, a new page is opened.

   Step 4  

For both screens, after choosing the option as defined you see a  new page where you can upload your project, you can drag & drop or click on choose your files to upload your files and make sure it doesn’t accept folders instead you can choose zip, file, image, pdf and any other and not a folder.

Wait until it gets updated and, write any note or description inside commit changes and click on commit changes.and that’s it your code is updated to git, and it’s ready to share, you can copy the link from code which is after the add file, from there you can copy the link and share.

In this way, you can upload your files directly from the github.com website.

#Method 2

In this method, the same process is followed as in method1 for step1 and step2, scroll up and follow the first and second steps.

In order to upload your files via command line, you need to have Git Bash which is used to upload files to git, if you are using Linux then no need to download, for windows it requires. Click to download Git Bash.

Now, go inside the folder lets suppose I want to upload files to testingone folder then first create a folder with any name inside your computer and open that folder.

If you are using Windows, right-click inside that folder, an option will be there, ‘open git bash here’ click on that and a black screen will appear.

If you’re on Linux, move inside testingone directory through terminal.

Follow the steps to upload files.We use few commands to upload

  •  git clone https://github.com/TejaswiReddy2/testingone.git   
  •  git pull  
  •  git init  
  •  git status  
  •  git add -A  
  •  git commit -m “comment”  
  •  git remote add origin https://github.com/TejaswiReddy2/testingone.git 
  •  git remote -v  
  •  git push origin master  
   Step 1  

Execute command  git clone https://github.com/TejaswiReddy2/testingone.git .This will clone i.e download all your files from your testingone folder in your Github, now you can see a folder with testingone is created. and move inside testingone directory using  cd testingone   and add all your files and to taht folder.

   Step 2  

Now initiate git using command  git init  if it is not initialized it gets else it will say reinitialized existing git repository. and execute command  git status to check which files are changed or added,you will see all the files which are newly modified.

   Step 3  

Now add all the files before push  git add -A  which adds all the files to push

   Step 4  

commit files  git commit -m “my first commit”  which creates a description to your changes, make sure you write any description otherwise it throws an error.

   Step 5  

commit files git remote -v  which Shows URLs of remote repositories when listing your current remote connections.

if you are using different folder names for git and in local then you need to use git remote add origin https://github.com/TejaswiReddy2/testingone.git instead of  git remote -v  

   Step 6  

commit files  git push origin master  this pushes all your code to git, and its done all your is updated to git, you can go to your git link and check.

 

I hope you guys found this topic interesting “how to upload project on github”.

Thankyou for reaching here,Do follow us on our Facebook & instagram page for more updates.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

The maximum upload file size: 2 MB. You can upload: image, document. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded.