remote add
- Git course
- Intermediate
- Lesson 26/82
- 4 min
Learn to add a new remote with git remote add.
Adding a New Remote
The git remote add command adds a new remote repository connection to your local repository. You specify the remote name first, followed by the repository URL on a platform such as GitHub.
git remote add origin https://github.com/user/project.gitIn this example, origin is the remote name and the URL is the connection address.
Remote Name and URL
A remote name is a short label used to identify a connection in commands. origin is a common name, but you can also use different names such as backup or company.
git remote add backup https://github.com/user/backup.git
git remoteYou can add multiple remote connections with different names to one repository.
Practice Add a Remote Connection
Create a new remote named backup. Use https://github.com/user/backup.git as its URL. After the command, list the connections to show that backup was added.
Starter code
# Yeni uzak depo ekle
# Bağlantıları listeleSample solution
git remote add backup https://github.com/user/backup.git
git remoteExpected output
backup
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which command adds a new remote repository?
- git clone add origin URL
- git remote -v origin URL
- git branch add origin URL
- git remote add origin URL Correct answer
Explanation: <code>git remote add</code> creates a new connection. The remote name and URL are provided in that order.
2 Add a Backup Remote
git remote add backup ____
git remote add backup https://github.com/user/backup.git
Explanation: The command contains the remote name first, followed by its URL. The address in this example uses HTTPS.
3 Remote Addition Components
| Term | Meaning |
|---|---|
git remote add |
Creates a new connection |
origin |
Remote name |
URL |
Repository address |
backup |
Second remote name |