1. Home
  2. Git
  3. Git Tutorial
  4. Git – Add Remote Repository

Git – Add Remote Repository

Git Add Remote Repository

In this chapter of Git Tutorial, You will learn how to add remote git repository in your local project directory. For example you are working on a project for many days, but still not added this project under Git. Now you have create a remote git repository and want to add your project under it.

Local Project Dir: /home/rahul/app1
Remote Git URL: [email protected]:projects/app1.git

Add Remote Repository

Now navigate to your project directory and use git remote add command to connect local directory to the remote repository.

$ cd /home/rahul/app1
$ git remote add origin [email protected]:projects/app1.git

Check Remote URL

To check remote URL in the local copy of code using the following command. In results, you will see two urls one for fetch and one for push operations.

rahul@tecadmin:~/app1$ git remote -v

origin	[email protected]:project/app1.git (fetch)
origin	[email protected]:project/app1.git (push)
Tags , ,