From 5733f97e1fdd4123f0bc9ded17aa75a3161846e5 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Fri, 31 Mar 2017 22:13:53 -0500 Subject: [PATCH] Add Update The URL Of A Remote as a git til --- README.md | 3 ++- git/update-the-url-of-a-remote.md | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 git/update-the-url-of-a-remote.md diff --git a/README.md b/README.md index ab3d0d7..c2ae0eb 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really warrant a full blog post. These are mostly things I learn by pairing with smart people at [Hashrocket](http://hashrocket.com/). -_519 TILs and counting..._ +_520 TILs and counting..._ --- @@ -168,6 +168,7 @@ _519 TILs and counting..._ - [Stashing Untracked Files](git/stashing-untracked-files.md) - [Untrack A Directory Of Files Without Deleting](git/untrack-a-directory-of-files-without-deleting.md) - [Untrack A File Without Deleting It](git/untrack-a-file-without-deleting-it.md) +- [Update The URL Of A Remote](git/update-the-url-of-a-remote.md) - [Verbose Commit Message](git/verbose-commit-message.md) - [Viewing A File On Another Branch](git/viewing-a-file-on-another-branch.md) - [What Changed?](git/what-changed.md) diff --git a/git/update-the-url-of-a-remote.md b/git/update-the-url-of-a-remote.md new file mode 100644 index 0000000..57be6e7 --- /dev/null +++ b/git/update-the-url-of-a-remote.md @@ -0,0 +1,29 @@ +# Update The URL Of A Remote + +I just changed the name of a Github repository. One of the implications of +this is that the remote URL that my local git repository has on record is +now out of date. I need to update it. + +If I use `git-remote` with the `-v` flag. I can see what remotes I currently +have. + +```bash +$ git remote -v +origin git@github.com:jbranchaud/pokemon.git (fetch) +origin git@github.com:jbranchaud/pokemon.git (push) +``` + +Now, to update the URL for that remote, I can use `git remote set-url` +specifying the name of the remote and the updated URL. + +```bash +$ git remote set-url origin git@github.com:jbranchaud/pokemon_deluxe.git +``` + +If I check again, I can see it has been updated accordingly. + +```bash +$ git remote -v +origin git@github.com:jbranchaud/pokemon_deluxe.git (fetch) +origin git@github.com:jbranchaud/pokemon_deluxe.git (push) +```