Git and GitHub – How to push/pull and clone files between Local machine and GitHub (Part-8)

Posted by

Pushing Existing Code to GitHub using HTTPS


  • Git must be installed on your local machine.
  • A GitHub account.
  • An existing project on your local machine.

Run below command

git push master

It will ask for personal token to connect to github

Create personal token from github

Go to profile –> Setting –> developer setting

Developer setting –>personal access tokens–> Tokens /(classic)–> generate new token

Now we can go and check the repository

File push to github repository

How to clone from github to local machine

 git clone

Next create ,modify the code, git add, commit follow below steps

78  touch file3
   79  git status
   80  git config :"RAj"
   81  git config ""
   82  git add
   83  git add --all
   84  git status
   85  git commit -m"adding other user"
   86  git status
   87  git log
   88  git push origin master

now push back to github (remote location)

git push origin master (if you done clone and can use origin instead of long url)


git push master


check repository now

Now other want to pull it

use below command

Use below so can use origin in future instead of long url

git remote add origin

Now use

git pull origin master

Now, Sync the local repository as remote repository

Now using SSH

First need to generate SSH key using below


Copy public key in github

where to copy in github –> go to profile –> setting–> SSH and GPC key –> new ssh key — add public and save it

Use ssh link same way as we doing for https:
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x