diff --git a/snippets/change-remote-url.md b/snippets/change-remote-url.md new file mode 100644 index 000000000..826549b4a --- /dev/null +++ b/snippets/change-remote-url.md @@ -0,0 +1,17 @@ +--- +title: Change the remote URL +tags: repository,intermediate +--- + +Changes the URL of the remote repository. + +- Use `git remote set-url origin ` to change the URL of the remote repository to ``. + +```sh +git remote set-url origin +``` + +```sh +git remote set-url origin https://github.com/30-seconds/30-seconds-of-code +# The remote URL is now "https://github.com/30-seconds/30-seconds-of-code" +``` diff --git a/snippets/view-remote-url.md b/snippets/view-remote-url.md new file mode 100644 index 000000000..2ffeacb4e --- /dev/null +++ b/snippets/view-remote-url.md @@ -0,0 +1,17 @@ +--- +title: View the remote URL +tags: repository,intermediate +--- + +Displays the URL of the remote repository. + +- Use `git config --get remote.origin.url` to view the URL of the remote repository. + +```sh +git config --get remote.origin.url +``` + +```sh +git config --get remote.origin.url +# https://github.com/30-seconds/30-seconds-of-code +```