我如何 git 克隆特定版本?

How can I git clone an specific release?

嗯,我看到有人在谈论克隆一个 git 版本,但我不明白,我按照他们给出的教程进行操作。

How to git clone a specific release?

这是他们给的教程命令

$ git clone  git@github.com:mygitname/theproject.git --branch 1.0.2

以下是我尝试过的一些命令。

~ $ git clone  git@github.com:discordjs/discord.js --branch 13.2.0
Cloning into 'discord.js'...
error: cannot run ssh: No such file or directory
fatal: unable to fork
~ $ git clone https://github.com/discordjs/discord.js/releases/tag/13.2.0
Cloning into '13.2.0'...
fatal: https://github.com/discordjs/discord.js/releases/tag/13.2.0/info/refs not valid: could not determine hash algorithm; is this a git repository?
~ $ git clone discordjs/discord.js --branch 13.2.0
fatal: repository 'discordjs/discord.js' does not exist

但没有任何效果,有人可以帮助我吗?我会很感激的。

问题出在您尝试使用的 git 遥控器 url 上。

试试下面的方法,它会克隆特定版本

git clone https://github.com/discordjs/discord.js.git --branch 13.2.0

您尝试使用的那些无效的原因:

// the remote url is an ssh url and you probably don't have ssh installed
git clone git@github.com:discordjs/discord.js --branch 13.2.0

//not valid git remote urls
git clone https://github.com/discordjs/discord.js/releases/tag/13.2.0
git clone discordjs/discord.js --branch 13.2.0