garfbradaz garfbradaz -4 years ago 108
Git Question

Remotely Fork Github Repository

From my local machine (Windows 10) using the command-line, can I fork someone else repository without having to use the Fork button on the site?

Use Case

I'm wanting to create a setup script that forks a repository remotely on Github to a remote Github repository within my account, then
git clone
the forked repository to my local machine.

Answer Source

Unfortunately, "Forking" is not actually a git function.

By this I mean that without extra plugins or scripts, git by itself does not have a function "fork", nor does it know how to ask the remote how to do a fork.

Instead, this is purely a function that the hosting partner provides, usually through its web user interface.

However, GitHub have a REST API, and with it you can instruct GitHub to manage forks.

As such, I think your best way forward would be to either find a script or plugin or program that asks GitHub to do this fork, or build one yourself using this REST API.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download