有没有办法直接使用命令行来分叉存储库?

Pre*_*jan 3 git github git-fork

我正在尝试弄清楚如何使用命令行分叉 git/github 存储库。

我尝试过,但它说'fork' is not a git command.。有没有办法使用命令行来分叉存储库。

git: 'fork' is not a git command.
See 'git --help'.

The most similar command is fsck
Run Code Online (Sandbox Code Playgroud)

Von*_*onC 8

Fork 是一种GitHub 操作,而不是 Git 操作。

\n

您可以使用 GitHub CLIgh fork命令来创建分支。

\n

例子:

\n
# Create a fork for another repository.\n~/Projects$ gh repo fork cli/cli\n- Forking cli/cli...\n\xe2\x9c\x93 Created fork cli/cli\n? Would you like to clone the fork? Yes\nCloning into \'cli\'...\n\xe2\x9c\x93 Cloned fork\n~/Projects$ cd cli\n~/Projects/cli$\n
Run Code Online (Sandbox Code Playgroud)\n

这样,您就不必克隆任何存储库:创建分叉存储库,然后为您克隆。

\n

这与在您自己的存储库中创建分支不同。

\n
\n

另请参阅gh repo fork -- fork-name=xxxgh 2.5.0(2022 年 2 月)

\n