[英]Git Clone - Can't clone remote repository
我正在尝试克隆一个远程位于我的本地计算机上的项目。
所以:
1)我导航到要保存文件的本地文件夹。
2)我连接到远程计算机上的ssh:ssh something@server.webserver.com/devproject.git/
3)我执行git clone命令:git clone ssh://something@server.webserver.com/devproject.git/
我得到:致命的:目标路径'devproject'已经存在,并且不是空目录。
我的本地计算机上没有devproject。 我已经检查并重新检查。
我想念什么?
谢谢。
切入远程计算机后键入的任何命令都在该计算机上执行,而不是在本地计算机上执行。 删除步骤2。
您是在本地计算机上还是通过SSH连接执行步骤3? 尝试跳过步骤2。
您正在sshing到服务器,并试图克隆您的回购。 这就是导致fatal: destination path 'devproject' already exists and is not an empty directory.
不要SSH到服务器。 跳过那部分。
注意:与ssh问题无关,您可以在t/t5603-clone-dirname.sh
看到所有可能的git clone url/arguments
。
该文件的第一个版本显示了一些失败的克隆命令,这些URL的结尾是斜杠(es),即git 2.4.8(2015年8月3日,即将在2015年9月发布的2.5.1中已修复):
test_clone_dir ssh://host/foo.git/ foo fail
test_clone_dir ssh://host/foo.git/// foo fail
test_clone_dir host:foo.git/ foo fail
test_clone_dir host:foo.git/// foo fail
请参阅Jeff King( peff
)的 commit db2e220和commit d6a31e0 (2015年8月10日) 。
(由Junio C gitster
- gitster
在commit 52f6893中合并 ,2015年8月25日)
clone
:在guess_dir_name
使用计算长度提交7e837c6 (
clone
:简化guess_dir_name()
字符串处理,2015-07-09)将clone更改为使用strip_suffix而不是手动滚动指针操作。
但是,strip_suffix
将从NUL终止的字符串的末尾剥离,并且我们可能已经剥离了一些字符(例如目录分隔符或“/.git
”)。
这导致如下命令:
git clone host:foo.git/
无法剥离“
.git
”。
我不知道这是否是原因,但是您的克隆URL( ssh://something@server.webserver.com/devproject.git/
)末尾带有斜杠。 也许是什么原因造成的?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.