Push Code to Github using Command Line (Terminal)

Published: 22 August 2022
on channel: WebStylePress
187,439
1.6k

How can we push code or files from local PC to github using command line? I am using windows operating system. For terminal program I have 'Git for Windows'. First of all you should be logged in to github and SSH keys from PC should be added to your github account so that communication from PC to github can be possible. Then create a new repository at github. Next page shows useful commands that can be used to push local files to Github.

Browse to your project directory in your PC. Open terminal or command line tool or terminal in the same directory.

Use following commands:
Initialize local directory as a git repository using:
git init

Add all files to local repository using:
git add .
Now files are staged for first commit

Check status and see all files staged for commit using:
git status

Commit files that are staged in local repository using:
git commit -m "First commit"

Specify remote repository url and add url for remote repository where local repository will be pushed using:
git remote add origin repo-url

Push the code in local repository to Github using:
git push -u origin master

See github repo page and your files will be there that are pushed.

Here are all the commands in sequence:

git init
git add .
git status
git commit -m "any comment here in quotes"
git remote add origin repo-url
git push -u origin master

Git Clone, Add, Push Easy Way | Lazy Dev
   • Git Clone, Add, Push Easy Way | Lazy Dev G...  
Use Git with Windows EASILY | Add, Commit, Push to Github via Graphical User Interface
   • Use Git with Windows EASILY | Add, Commit,...  
Git Commands Tutorial | Git Clone, Add, Commit, Push, Pull, Checkout, Branch, Status
   • Git Commands Tutorial | Git Clone, Add, Co...  
Learn Common Git Commands - Git clone, pull, add, commit, push, checkout
   • Learn Common Git Commands - Git clone, pul...  

Thank You!
👍 LIKE VIDEO
👊 SUBSCRIBE
🔔 PRESS BELL ICON
✍️ COMMENT

Connect with me: You can find me on social media using the same handle: WebStylePress

#git #github #githubtutorial #webdevelopment #WebStylePress #code #softwaredevelopment #softwareengineering #programming


On this page of the site you can watch the video online Push Code to Github using Command Line (Terminal) with a duration of hours minute second in good quality, which was uploaded by the user WebStylePress 22 August 2022, share the link with friends and acquaintances, this video has already been watched 187,439 times on youtube and it was liked by 1.6 thousand viewers. Enjoy your viewing!