2021-05-01 23:50:42 +02:00
|
|
|
If you have an existing repository and want to add a new remote you can use this command:
|
2021-12-08 14:31:46 +01:00
|
|
|
```bash
|
2021-05-01 23:50:42 +02:00
|
|
|
git remote add <name> <url>
|
|
|
|
```
|
|
|
|
Example:
|
2021-12-08 14:31:46 +01:00
|
|
|
```bash
|
2021-05-01 23:50:42 +02:00
|
|
|
git remote add origin git@github.com:Asocia/til.git
|
2021-07-07 13:50:23 +02:00
|
|
|
git push -u origin my_branch
|
2021-05-01 23:50:42 +02:00
|
|
|
```
|
2021-07-07 13:50:23 +02:00
|
|
|
|
|
|
|
If you get an error like
|
|
|
|
```
|
|
|
|
error: remote origin already exists.
|
|
|
|
```
|
|
|
|
|
|
|
|
you can:
|
|
|
|
|
|
|
|
- remove the origin and try again. `git remote remove origin`
|
|
|
|
- add it with a different name. `git remote add ... ...`
|