CodeBlanks Logo Icon CodeBlanks

remote add

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.git

In 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 remote

You 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

terminal
# Yeni uzak depo ekle

# Bağlantıları listele

Sample solution

terminal
git remote add backup https://github.com/user/backup.git
git remote

Expected 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

Question
git remote add backup ____
Answer
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

All lessons in Intermediate

20 Intermediate final

  1. Branch management
  2. Rebase
  3. Conflict
  4. PR flow