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

允我心安 提交于 2019-12-25 03:19:27

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/26005718/git-clone-always-clone-the-same-repo-no-matter-what-url-i-provide

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!