mac似乎不是一个git存储库,但缺少斜杠

mac似乎不是一个git存储库,但缺少斜杠,git,macos,gitlab,clone,Git,Macos,Gitlab,Clone,我 它失败了 git clone -v https://test.example.cc/Taotie/discover.git /Users/Macbook/go/src/test.example.cc/Taotie/discover 但是如果我 git clone https://test.example.cc/Taotie/discover.git Cloning into 'discover'... fatal: 'git@test.example.ccTaotie/discover.g

它失败了

git clone -v https://test.example.cc/Taotie/discover.git /Users/Macbook/go/src/test.example.cc/Taotie/discover
但是如果我

git clone https://test.example.cc/Taotie/discover.git
Cloning into 'discover'...
fatal: 'git@test.example.ccTaotie/discover.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
它起作用了

我不知道为什么它在git url中缺少“/”字符

如果我

git clone https://github.com/xormplus/xorm.git
这是可行的,因为我已经将我的mac rsa_pub添加到gitlab中,并且我始终可以使用这种格式成功克隆git

git clone git@test.example.cc:Taotie/discover.git
我问这个问题的原因是我使用go-get并返回错误

 git clone git@test.example.cc:anything/project.
最后,
git config——全局url。“git@test.example.cc:“.代替”https://test.example.cc/“
解决了我的问题~~~

正如@Oren\u C所说:


“致命的:'git@test.example.ccTaotie/discover.git“似乎不是git存储库”这是一种与SSH克隆相关的语法

您正在使用SSH进行克隆,并且repo已经存在,剩下的唯一选项是您没有向git实例添加SSH公钥

您可以从
~/.ssh/id\u rsa.pub

编辑 OP使用了错误的url。修复方法是使用:
git@test.example.cc:Taotie/discover.git
注意主机和repo之间的
,而不是
/

编辑2 要将repo克隆到给定目录中,请使用以下命令:

bogon:Taotie Macbook$   go get test.example.cc/Taotie/discover
# cd .; git clone https://test.example.cc/Taotie/discover.git /Users/Macbook/go/src/test.example.cc/Taotie/discover
Cloning into '/Users/Macbook/go/src/test.example.cc/Taotie/discover'...
fatal: 'git@test.example.ccTaotie/discover.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
package test.example.cc/Taotie/discover: exit status 128
这将克隆给定目录中的repo:
/Users/Macbook/go/src/test.example.cc/Taotie/discover

最后编辑 要使用Golang克隆它,您应该添加一个配置:

git clone git@test.example.cc:Taotie/discover.git /Users/Macbook/go/src/test.example.cc/Taotie/discover
这将替换生成的git url,使其格式正确:
git@host.tld/名称/repo.git


然后运行
go-gethttps://test.example.cc/Taotie/discover.git

如果您这样做会怎么样:
cd/Users/Macbook/go/src/test.example.cc/Taotie&&git clonehttps://test.example.cc/Taotie/discover.git 发现
?“致命:”git@test.example.ccTaotie/discover.git“似乎不是git存储库”这是一种与SSH克隆相关的语法。你能详细说明一下你写的命令吗?@SajibKhan我照你说的做,然后我得到了相同的错误bogon:Taotie Macbook$git clone discover克隆到“discover”。。。致命的:'git@test.example.ccTaotie/discover.git似乎不是git存储库致命:无法从远程存储库读取。请确保您具有正确的访问权限,并且存储库存在。如果此操作
git clone,请重试https://test.example.cc\/Taotie/discover.git discover
?@SajibKhan它也失败了<代码>博根:淘铁Macbook$git克隆https://test.example.cc\/Taotie/discover.git发现克隆到“discover”。。。致命的:'git@test.example.ccTaotie/discover.git'似乎不是git存储库致命:无法从远程存储库读取。我已经将我的~/.ssh/id_rsa.pub添加到gitlab和git克隆中git@test.example.cc:Taotie/discover.git总是有效的。现在我正在尝试用谷歌搜索一些东西关于“与SSH克隆相关的语法”~\u~如果我
git clone-vhttps://test.example.cc///////////Taotie/discover.git  
克隆到“discover”中的错误是相同的
。。。致命的:'git@test.example.ccTaotie/discover.git似乎不是git存储库致命:无法从远程存储库读取。请确保您具有正确的访问权限,并且存储库存在。
您可以使用git url而不是
https
url吗<代码>git@test.example.cc:Taotie/discover.git注意
而不是
/
。完整命令应该是
git clonegit@test.example.cc:Taotie/discover.git
这将克隆您当前文件夹中的回购。太棒了,用解决方案更新了答案。请随意将其标记为答案
git config--global url。“git@test.example.cc:“.代替”https://test.example.cc/“
解决了我的问题,谢谢。
git config --global url."git@test.example.cc:".insteadOf "https://test.example.cc/"