Git Remote Repository Configuration: Adding, Modifying, and Deleting Remote Repository URLs

This article introduces methods for managing Git remote repository addresses, suitable for beginners. A remote repository is a cloud-hosted Git repository (e.g., GitHub), where the local repository is associated with the remote via an address, supporting operations like push (pushing local code to the remote) and pull (pulling remote code to the local). ### Core Operation Steps: 1. **Check Association**: Execute `git remote -v`. If there is no output, no association exists. 2. **Add Address**: Use `git remote add [alias] [address]`. The default alias is `origin`, and the address can be copied from the remote platform (supports HTTPS or SSH formats). 3. **Modify Address**: When the address changes, run `git remote set-url [alias] [new address]`. 4. **Delete Address**: Use `git remote remove [alias]` or `rm`. After deletion, the association must be re-established by re-adding the address. ### Notes: - The address format must be correct (HTTPS includes `https://`, SSH starts with `git@`); - Aliases must be unique to avoid duplicates; - After modifying an HTTPS address, re-authentication of account credentials may be required; - After deletion, the association must be re-added to restore the connection. (Note: The original text ends abruptly with "Through `git remote -", so the translation includes the visible content only.)

Read More