Skip to content

Instantly share code, notes, and snippets.

@kevinsawicki
Created August 26, 2011 23:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kevinsawicki/1174690 to your computer and use it in GitHub Desktop.
Save kevinsawicki/1174690 to your computer and use it in GitHub Desktop.
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