使用.sh(shell)克隆具有特定标记的github项目

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用.sh(shell)克隆具有特定标记的github项目相关的知识,希望对你有一定的参考价值。

我尝试使用shell .sh克隆一个带特定标记的github项目没有成功

在这种情况下,我想下载此版本:https://github.com/litecoin-project/litecoin/releases/tag/v0.8.0

有趣的部分是Litecoin路径不存在,如果只使用:git clone -b 0.8 https://github.com/litecoin-project/litecoin.git

我可以克隆项目。

我在.sh中使用这一行

git clone https://github.com/litecoin-project/litecoin.git
git tag -l
git checkout 0.8

# git clone --branch 0.8 git@github.com:litecoin-project/litecoin.git
# git clone -b 0.8 https://github.com/litecoin-project/litecoin.git

错误我的电脑中没有litecoin文件夹,但让我显示:

fatal: destination path 'litecoin' already exists and is not an empty directory.
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
答案

第一个错误

fatal: destination path 'litecoin' already exists and is not an empty directory 

如果您尝试克隆而不删除已存在的文件夹,则会发生

错误

fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git

是因为你需要先cd成litecoin文件夹。

git clone https://github.com/litecoin-project/litecoin
cd litecoin
git tag -l
git checkout 0.8

对我来说很好

以上是关于使用.sh(shell)克隆具有特定标记的github项目的主要内容,如果未能解决你的问题,请参考以下文章

sh git cloneで特定ブランチを克隆

sh [在标记为2的情况下打开]在标记为2的#shell中打开文件

Shell基础:

01.shell变量

sh 一个shell脚本,可以帮助您计算特定人员的贡献

Linux shell介绍 及克隆配置