Bird
0
0

You want to change the URL of the remote named 'origin' after adding it with git remote add origin https://old-url.com/repo.git. Which command correctly updates the URL?

hard📝 Application Q9 of 15
Git - Remote Repositories
You want to change the URL of the remote named 'origin' after adding it with git remote add origin https://old-url.com/repo.git. Which command correctly updates the URL?
Agit remote add origin https://new-url.com/repo.git
Bgit remote set-url origin https://new-url.com/repo.git
Cgit remote update origin https://new-url.com/repo.git
Dgit remote rename origin https://new-url.com/repo.git
Step-by-Step Solution
Solution:
  1. Step 1: Understand how to update remote URL

    To change a remote's URL, use git remote set-url <name> <new-url>.
  2. Step 2: Identify the correct command

    git remote set-url origin https://new-url.com/repo.git uses the correct syntax to update 'origin' URL.
  3. Final Answer:

    git remote set-url origin https://new-url.com/repo.git -> Option B
  4. Quick Check:

    Update remote URL with 'git remote set-url' [OK]
Quick Trick: Use 'git remote set-url' to change remote URLs [OK]
Common Mistakes:
  • Trying to add remote again instead of updating
  • Using 'git remote update' incorrectly
  • Confusing rename with URL change

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes