Thursday, 15 January 2026

How to push Git local repository to Github ?

Github is web-based platform for managing code projects. Git on the other hand is an open-source version control system that tracks changes in code and allows multiple people to work on the same project simultaneously. Below is a simple tutorial to upload a git local repository to remote Github platform:

1. Navigate to github.com 











2. Login to Github using Google or manually create a new account















3. Next click New to create a new remote Github repository












4. Next it requires entering the repository name exactly as in below image for simplicity











5. Submitting form for creating new repository with default settings











6. It will redirect to repository success page









7. After scrolling down some directions can be seen as in below image to upload the repository









8. Next in the Terminal or Command Prompt, hit below command for creating and navigating the directory









9. Then create a new file in the github-repo-test directory named README.md









10. Initiate editing the file using gedit tool or any tool of choice









11. Next add content to the file as below provided













12.1 Making sure Git is installed by hitting below commands(git --version)









12.2 If Git is not installed, it can be installed using below command in Linux








12.3 In case if your Operating System is Windows below url can be used to install








12.4 In case if your Operating System in MacOS, below link can be used:
















13. Initializing git repository using git init command











14. Next it requires checking the status of the repository, currently it will show no commits yet











15. Before commit it requires to check and change the user git system configuration, mainly user.name and user.email hash needs to be set










16. For setting them, below last two commands are used, replace values in double quotes as per your credentials









17. Next it requires to change the status from unstaged to staged using git add -A command












18. Next branch is to be renamed to main from master using git branch -M main command










19. Next remote urls can be checked using git remote -v and remote url can be added using git remote add origin url(as provided in the page after creating repository), the url can be tracked from the page as in the below image













20.1 Navigating Account Settings for token generation









20.2 Scrolling down to navigate Developer settings












20.3 Next navigate to Tokens(classic) side menu item












20.4 Generating new classic token dropdown to be chosen as in below image










20.5 Token name, it's expiration, and scopes are to be provided, for scope just repo is to be checked












20.6 Next scrolling and clicking Generate token button is required












20.7 Single time token will be shown just for once, therefore the token is to be saved









21. Pushing local repo to remote Github repo using command git push origin main










22.1 Next it requires to navigate to self(account) repositories as in below image









22.2 Then navigation to the repository is to be made






23. Remote repository and Readme.md file content can be seen below as in the provided image




No comments:

Post a Comment