Add remote URL snippets
This commit is contained in:
17
snippets/change-remote-url.md
Normal file
17
snippets/change-remote-url.md
Normal file
@ -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 <url>` to change the URL of the remote repository to `<url>`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git remote set-url origin <url>
|
||||||
|
```
|
||||||
|
|
||||||
|
```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"
|
||||||
|
```
|
||||||
17
snippets/view-remote-url.md
Normal file
17
snippets/view-remote-url.md
Normal file
@ -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
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user