Published March 06, 2018 by

Git – Add Remote Repository

In this Git Tutorial, we will learn how to add remote git repository in your local project directory. Now you have created a remote git repository and want to add your project to it.

Local Project Dir: /root/projects/myfirstrepo
Remote Git URL: git@remote_server_location:projects/myfirstrepo.git

Add Remote Repository

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


# cd /root/projects/myfirstrepo
# git remote add origin git@remote_server_location:projects/myfirstrepo.git

Check Remote Git URL

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


root@subhash:~/myfirstrepo# git remote -v

origin     git@remote_server_location:projects/myfirstrepo.git (fetch)
origin     git@remote_server_location:projects/myfirstrepo.git (push)


Previous: Create Repository                                                         Next: Add and Delete Files