32

In our Development environment, I can see that the GIT repository was cloned from TEST,

In the config file,

[remote "origin"]
   url = //foo/test-foo-project
   fetch = +refs/heads/master:refs/remotes/origin/master

I now want to pull the repository in Development, to my local instance. I know //foo/test-foo-project isn't a real path.. But I can determine which URL to use?

Kye
  • 5,919
  • 10
  • 49
  • 84
  • You can't really do this with Git. As Git is decentralised, repositories only store locations of "remotes", other repos they're somehow connected to, like they one they were cloned from. They don't track the entire network of repositories. Clone your local repo from wherever you intend to push changes, and add whichever other remotes you with. If you don't need to push changes, you can clone the DEV one directly. – millimoose May 09 '13 at 00:35
  • 1
    possible duplicate of [How can I determine the url that a local git repo was originally cloned from?](http://stackoverflow.com/questions/4089430/how-can-i-determine-the-url-that-a-local-git-repo-was-originally-cloned-from) – mvw Apr 11 '14 at 11:00

3 Answers3

44

Git command that could get you the url from origin

$git config --get remote.origin.url

But you would not be able to set a new path

$git config remote.origin.url "newPath"

This would fail with the message error: could not lock config file ./config: File exists

jacob aloysious
  • 2,547
  • 15
  • 16
2

In your home directory do less .shh/config then you can see the URL for foo.

If it is not there you can try git remote show and then probably git remote show origin.

Do you remember how you cloned this repo, can you past the command here?

Wojciech Bednarski
  • 6,033
  • 9
  • 49
  • 73
-2

Simply you can find a url for a local GIT repo by giturl command.

$ gem install giturl
$ giturl .
https://*****/