In this article we will see the process to connect git to GitHub.

How to Connect Git to Github?

Github is a very popular version control system. We can use it to store our local git commits and access them anywhere with an internet connection.

To push a repo to github

  • Visit github.com
  • Login with your credentials
  • Click the new repository button which will bring you to a page like this

How to Connect Git to Github_Pic1

  • After filling in the required fields create the repository
  • Now click “Push an existing repository”
  • In the git terminal on your machine
    $ git remote add origin https://github.com/username/new_repo

$ git remote add origin https://github.com/username/new_repo

  • Enter your password then set the branch to main
    $ git branch -M main

● Enter your password then set the branch to main $ git branch -M main

  • Push the branch

        $ git push -u origin master

How to connect git to Github

  • After successful pushing, we will have

Leave a Reply

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