You can add a GitHub repository as a remote to your local Git repository by using the git remote add command. Here are the steps:

  1. Open a terminal in your local repository’s directory.
  2. Run the following command to add a new remote:

git remote add origin https://github.com/username/repo.git

Replace https://github.com/username/repo.git with the URL of your GitHub repository. The origin is a name that Git uses to refer to the remote repository. You can choose another name if you want.

  1. Verify that the remote has been added correctly by running:

git remote -v

This command should display the URL of your GitHub repository next to the name origin.

  1. Now, you can push your commits to the GitHub repository by running:

git push -u origin master

Replace master with the name of the branch that you want to push.

Please note that you need to have write access to the GitHub repository to push changes to it. If the repository is private, you may also need to enter your GitHub username and password.