How do you add a remote repository in Git?

How do you add a remote repository in Git?

a) git add remote
b) git remote add
c) git remote new
d) git push remote

Answer:

b) git remote add

Explanation:

The git remote add command is used to add a new remote repository to your Git configuration. It links your local repository to the remote, allowing you to push and pull changes between them.

For example, git remote add origin https://github.com/user/repo.git adds the origin remote, which points to the specified GitHub repository.

Adding a remote is essential for collaborating on projects, as it enables you to synchronize your work with a central repository.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top