Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Forks a repository using API v3
import java.io.IOException;
import org.eclipse.egit.github.core.RepositoryId;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.service.RepositoryService;
public class Fork {
public static void main(String... args) throws IOException {
GitHubClient client = new GitHubClient();
client.setCredentials("user", "passw0rd");
RepositoryService service = new RepositoryService(client);
RepositoryId toBeForked = new RepositoryId("kevinsawicki", "gitective");
service.forkRepository(toBeForked, "jenkinci");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment