简体   繁体   English

尝试克隆TensorFlow存储库时,git clone不起作用

[英]git clone does not work when trying to clone a TensorFlow repository

When I do 当我做

~$ git clone https://github.com/tensorflow/models/tree/master/research/inception/inception

I get an error: 我收到一个错误:

Cloning into 'inception'... remote: Not Found fatal: repository ' https://github.com/tensorflow/models/tree/master/research/inception/inception/ ' not found 克隆到'inception'中...远程:未找到致命:存储库' https://github.com/tensorflow/models/tree/master/research/inception/inception/ '未找到

And the URL actually works when I paste it into my browser. 当我将URL粘贴到浏览器中时,该URL实际上就起作用了。 So I am confused about what the problem could be here. 因此,我对这里可能出现的问题感到困惑。 Thanks 谢谢

You are using an incorrect inner URL. 您使用的内部URL不正确。 With Git you cannotclone selectively. 使用Git,您将无法选择性克隆。

The correct URL should be, 正确的网址应该是

https://github.com/tensorflow/models.git

The command is, 命令是

git clone https://github.com/tensorflow/models.git

I see, but if I want to clone the sub-directories such as inception do I still have to use the URL above? 我知道了,但是如果我想克隆子目录(例如inception),是否仍然需要使用上面的URL?

While you would still clone the full repo, you can do a sparse checkout 虽然您仍然可以克隆完整的仓库,但可以进行稀疏签出

mkdir myrepo
cd myrepo
git init
git config core.sparseCheckout true
git remote add -f origin https://github.com/tensorflow/models.git
echo "path/within_repo/to/desired_subdir/*" > .git/info/sparse-checkout
git checkout [branchname] # ex: master

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM