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?

6
  • 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. Commented Jun 19, 2015 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. Commented Jun 19, 2015 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. Commented Jun 19, 2015 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. Commented Jun 19, 2015 at 15:48
  • 1
    There is no purpose to doing that. It should not be done for any reason I can think of. Commented Jun 19, 2015 at 15:50

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

4 Comments

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.
@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.
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.
@user230137 sure: the global config (stackoverflow.com/a/2115116/6309) is usually for properties you want to apply to all repos (like user.name and user.email)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.