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

git clone does not work when trying to clone a TensorFlow repository

当我做的时候

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

我收到一个错误:

Cloning into 'inception'... remote: Not Found fatal: repository 'https://github.com/tensorflow/models/tree/master/research/inception/inception/' not found

当我将它粘贴到我的浏览器中时,URL 确实有效。所以我对这里可能出现的问题感到困惑。谢谢

您使用的内部 URL 不正确。使用 Git 你不能有选择地克隆。

正确的URL应该是

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

命令是,

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?

虽然您仍会克隆完整的存储库,但您可以执行 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