git clone总是克隆相同的仓库,无论我提供什么URL [英] git clone always clone the same repo no matter what url I provide
问题描述
无论我使用什么git clone url,git总是从bitbucket克隆我的旧项目之一。例如,当我做这样的事情时:
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
我不是从heroku克隆,而是从我的位桶存储库。
我试图删除与ssh关联的所有键,并创建新的键,但是无论我做什么,结果都是一样的。请帮忙。谢谢
请让我知道是否需要提供更多信息。
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.
推荐答案
我遇到了完全相同的问题。我尝试克隆哪个存储库都没关系,它总是每次都克隆相同的存储库。甚至使用purge和autoremove重新安装git也无济于事。
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.
最终,我将.gitconfig文件放在主目录中,并找到以下设置:
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将此文件编辑为:
[user]
email = <my_email>@gmail.com
name = Tim Bushell
...,我能够再次克隆任何存储库。
... and I was able to clone any repo once again.
我不清楚.gitconfig如何获得此设置。
I'm not clear how the .gitconfig gained this setting.
这篇关于git clone总是克隆相同的仓库,无论我提供什么URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!