[英]Windows git bash: git clone https://github.com/... results with fatal: working tree ... already exists
So I'm trying to clone a repo from here所以我试图从这里克隆一个回购
https://github.com/nglglhtr/getter-setter https://github.com/nglglhtr/getter-setter
I created a new folder FirstDapp and opened git gui here then opened git bash from there我创建了一个新文件夹 FirstDapp 并在此处打开 git gui 然后从那里打开 git bash
then I entered:然后我输入:
git clone https://github.com/nglglhtr/getter-setter
then the bash terminal said: fatal: working tree 'D/.../FirstDapp' already exists然后 bash 终端说:致命:工作树'D/.../FirstDapp'已经存在
so I tried the solutions from here:所以我尝试了这里的解决方案:
Exception "working tree already exists" while cloning GIT repo in pre-push hook 在预推送挂钩中克隆 GIT 存储库时出现异常“工作树已存在”
but those didn't work.但那些没有用。 Any ideas?有任何想法吗?
When you run:当你运行时:
git gui
the GUI will search for an existing Git repository in Git's usual fashion: GUI 将以 Git 的常用方式搜索现有的 Git 存储库:
/path/to/current/dir
, remove the /dir
part leaving /path/to/current
, and start over.如果没有,请尝试“爬上一层”,例如,从/path/to/current/dir
删除/dir
离开/path/to/current
的部分,然后重新开始。 If this runs out of places to look, git gui
opens a smaller, different-looking window and offers you a chance to clone or create a repository.如果没有地方可以查看, git gui
打开一个更小、外观不同的 window,并为您提供克隆或创建存储库的机会。
(There are step I'm omitting on purpose here to simplify things, in that Git won't keep going after certain points, and under certain conditions, but these generally won't apply to your case.) (为了简化事情,我故意省略了一些步骤,因为 Git 在某些点和某些条件下不会继续执行,但这些通常不适用于您的情况。)
Since you did:既然你这样做了:
mkdir FirstDapp
cd FirstDapp
(or the Windows equivalent) and did not run a subsequent: (或 Windows 等效项)并且没有运行后续:
git init
there must not be a Git repository at the FirstDapp
level, but Git-GUI found one, so there must be a Git repository at a higher level. FirstDapp
层级一定没有Git存储库,但Git-GUI找到了,所以更高层级肯定有Git存储库。 This is the repository that Git-GUI opened.这是 Git-GUI 打开的存储库。
To get around that problem, you should create—with git init
or git clone
—a repository within the FirstDapp
directory:为了解决这个问题,你应该使用git init
或git clone
创建一个在FirstDapp
目录中的存储库:
git clone https://github.com/nglglhtr/getter-setter
for instance.例如。 Then running git gui
will find that repository.然后运行git gui
将找到该存储库。 If you create an empty one, you'll need to do all the remaining steps that git clone
would do, so it will be easier to use git clone
.如果创建一个空的,则需要执行git clone
将执行的所有剩余步骤,因此使用git clone
会更容易。
(As an aside, Git-GUI is not generally recommended. It's a bit of a toy example, rather than a real GUI. I personally dislike GUIs in the first place and will avoid them whenever I can, and recommend that you do the same, but tastes differ.) (顺便说一句,一般不推荐使用 Git-GUI。它只是一个玩具示例,而不是真正的 GUI。我个人首先不喜欢 GUI,并且会尽可能避免使用它们,并建议您也这样做,但口味不同。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.