0

I have this below in my .gitconfig file:

[remote "origin"]
   url = https://github.com/eldur/jwbf

Now when I do:

git clone https://github.com/google/skicka.git

git clone the https://github.com/eldur/jwbf project to skicka folder. Is it normal?

Hunsu
  • 3,281
  • 7
  • 29
  • 64
  • 2
    Back up. What folder structure are we talking about here? You shouldn't be cloning a git repo inside another one unless you know what you're doing. – Two-Bit Alchemist Jun 19 '15 at 15:39
  • @Two-BitAlchemist I didn't know that there's `.gitconfig` file in my folder. I just tried to clone the second project and got the other project. I didn't know whare problem cam from. I have tried some git command a week ago but I didn't know that I have configured the remote. – Hunsu Jun 19 '15 at 15:47
  • It's very unusual to have a remote configured in `.gitconfig`, your user's global configuration file. Only things that should apply to *all* of your repositories belong in there. That could be causing a problem. – ChrisGPT was on strike Jun 19 '15 at 15:47
  • I hate to even give you advice here because it's so unclear from what information you have provided what your folder structure is or if this will break something, but it sounds like you should remove that line from your `.gitconfig`. – Two-Bit Alchemist Jun 19 '15 at 15:48
  • @Two-BitAlchemist that's what I have done. So what's the purpose to set a remote in your global `.gitconfig` ? – Hunsu Jun 19 '15 at 15:50
  • 1
    There is no purpose to doing that. It should not be done for any reason I can think of. – Two-Bit Alchemist Jun 19 '15 at 15:50

1 Answers1

1

First, remove any remote entry from your global config file

git config --global --unset-all remote.origin

Then clone your repo as usual (your second clone won't get the first repo!), and check your local config:

cd /path/to/local/second/cloned/repo
git config --local

You should see a remote.origin value which will match the repo you just cloned.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • You don't answer my question. I asked to know why it is possible to set remote globally to end up not able doing a clone by specifying an url. – Hunsu Jun 19 '15 at 19:06
  • @user230137 with `git config --global`. Why or how you did a git config --global, I don't know. So to answer your question "Is it normal?": no, it is not, and here is how to fix it. – VonC Jun 19 '15 at 19:07
  • Ok thanks, I did by mistake when following some tutorial. It took me some time to figure out the problem so I was curious to know why this feature is included in git. – Hunsu Jun 19 '15 at 19:13
  • @user230137 sure: the global config (http://stackoverflow.com/a/2115116/6309) is usually for properties you want to apply to *all* repos (like `user.name` and `user.email`) – VonC Jun 19 '15 at 19:16