如何在Git中克隆一个特定的版本?



嗯,我看到有人在谈论克隆一个Git版本,但我不懂,我就照着他们给的教程做了。

如何克隆一个特定的版本?

这是他们给出的教程命令。

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 the SSH software 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

最新更新