Git – Remote Add Repository

undefined

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 since 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/mimastech/app1
  • Remote Git URL : git@remote.example.com:project/app1.git

Add Remote Repository

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

$ cd /home/mimastech/app1

$ git remote add origin git@remote.example.com:project/app1.git

Check Remote URL

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

mimastech@mimastech.com:~/app1$ git remote -v 

origin	git@remote.example.com:project/app1.git (fetch)
origin	git@remote.example.com:project/app1.git (push)

If You Appreciate What We Do Here On Mimastech, You Should Consider:

  1. Stay Connected to: Facebook | Twitter | Google+
  2. Support us via PayPal Donation
  3. Subscribe to our email newsletters.
  4. Tell other sysadmins / friends about Us - Share and Like our posts and services

We are thankful for your never ending support.

Leave a Reply

Your email address will not be published. Required fields are marked *