From 61ae2147debd2351b4690ddf938b2e6a073ccdf2 Mon Sep 17 00:00:00 2001 From: Chalarangelo Date: Thu, 8 Apr 2021 19:42:57 +0300 Subject: [PATCH] Add remote URL snippets --- snippets/change-remote-url.md | 17 +++++++++++++++++ snippets/view-remote-url.md | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 snippets/change-remote-url.md create mode 100644 snippets/view-remote-url.md 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 +```