Search code examples
githerokuclonebitbucket

git clone always clone the same repo no matter what url I provide


No matter what git clone url I use, git always clones one of my old projects from bitbucket. For example when I do something like this:

git clone https://github.com/heroku/php-getting-started.git

instead of cloning from heroku, I get one of my projects (always the same project) from my bitbucket repository. I have tried to remove all the keys associated with the ssh, and create the new ones, but whatever I do the result is the same. Please help. Thank you Please let me know if I need to provide more information.


Solution

  • I had exactly the same problem. It didn't matter which repo I tried to clone, it always cloned the same repo each time. Even reinstalling git with purge and autoremove did not help.

    Eventually I located my .gitconfig file in my home directory and found the following settings:

    [user]
        email = <my_email>@gmail.com
        name = Tim Bushell
    [remote "origin"]
        url = git@gitlab.com:<name_of_same_repo>.git
    

    I edited this file to:

    [user]
        email = <my_email>@gmail.com
        name = Tim Bushell
    

    ... and I was able to clone any repo once again.

    I'm not clear how the .gitconfig gained this setting.