[英]mac does not appear to be a git repository miss a slash
I 一世
git clone -v https://test.example.cc/Taotie/discover.git /Users/Macbook/go/src/test.example.cc/Taotie/discover
It fail. 失败了
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.
but if I 但是如果我
git clone https://github.com/xormplus/xorm.git
it works. 有用。
I don't know why it miss a "/" int the git url . 我不知道为什么它会错过git url中的“ /”整数。
and if I 如果我
git clone git@test.example.cc:Taotie/discover.git
it works,because I have already add my mac rsa_pub into the gitlab and I can always git clone success with this format 它有效,因为我已经将mac rsa_pub添加到gitlab中,并且我总是可以使用这种格式git clone成功
git clone git@test.example.cc:anything/project.
The reason I ask this question it that I use go get and it return error 我问这个问题的原因是我使用go get并返回错误
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
Finally git config --global url."git@test.example.cc:".insteadOf "https://test.example.cc/"
solved my problem~~~ 终于
git config --global url."git@test.example.cc:".insteadOf "https://test.example.cc/"
解决了我的问题~~~
As @Oren_C said: 正如@Oren_C所说:
"fatal: 'git@test.example.ccTaotie/discover.git' does not appear to be a git repository" This is a syntax related to cloning with SSH.
“致命:'git@test.example.ccTaotie/discover.git'似乎不是git存储库”这是与SSH克隆相关的语法。
You're cloning with SSH that being said and the repo exists, the only option left would be that you didn't add a SSH public key to your git instance. 您正在说的是SSH克隆,并且该存储库存在,剩下的唯一选择是您没有在git实例中添加SSH公钥。
You can copy it from ~/.ssh/id_rsa.pub
您可以从
~/.ssh/id_rsa.pub
复制它
OP had used a wrongly url. OP使用了错误的网址。 The fix was to use:
git@test.example.cc:Taotie/discover.git
Note the :
between host and repo instead of /
解决方法是使用:
git@test.example.cc:Taotie/discover.git
: git@test.example.cc:Taotie/discover.git
注意主机和git@test.example.cc:Taotie/discover.git
之间的:
而不是/
To clone the repo into your given directory use the following command: 要将仓库复制到给定目录中,请使用以下命令:
git clone git@test.example.cc:Taotie/discover.git /Users/Macbook/go/src/test.example.cc/Taotie/discover
This will clone the repo in the given directory: /Users/Macbook/go/src/test.example.cc/Taotie/discover
. 这会将
/Users/Macbook/go/src/test.example.cc/Taotie/discover
复制到给定目录: /Users/Macbook/go/src/test.example.cc/Taotie/discover
。
To clone it with Golang you should add a configuration: 要使用Golang克隆它,您应该添加配置:
git config --global url."git@test.example.cc:".insteadOf "https://test.example.cc/"
This replaces the generated git url to be formatted correctly in the form of: git@host.tld/name/repo.git
这将替换生成的git url,并以以下格式正确格式化:
git@host.tld/name/repo.git
Then just run go get https://test.example.cc/Taotie/discover.git
然后运行
go get https://test.example.cc/Taotie/discover.git
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.