Bird
0
0

If you run git remote add origin https://github.com/user/repo.git twice without removing the remote, what will happen?

medium📝 Command Output Q5 of 15
Git - Remote Repositories
If you run git remote add origin https://github.com/user/repo.git twice without removing the remote, what will happen?
AGit will add a second remote named 'origin' with the same URL
BGit will show an error saying remote 'origin' already exists
CGit will update the existing 'origin' remote URL silently
DGit will remove the old 'origin' and add the new one
Step-by-Step Solution
Solution:
  1. Step 1: Understand behavior of adding existing remote

    Git does not allow adding a remote with a name that already exists.
  2. Step 2: Identify the error message

    Running the command again causes Git to show an error about the existing remote.
  3. Final Answer:

    Git will show an error saying remote 'origin' already exists -> Option B
  4. Quick Check:

    Adding existing remote name = error [OK]
Quick Trick: Cannot add remote with existing name; remove or rename first [OK]
Common Mistakes:
  • Assuming Git updates URL silently
  • Thinking Git adds duplicate remotes
  • Believing Git removes old remote automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes