How to configure tracking of an existing repo to a remote repo using ngit (or jgit)?

I am working on a gui helper utility that will:

  • Initiate local repo, Init (naked) remote repo
  • Add .gitignore based on project type
  • Commit all local files
  • Add remote repo to local configuration
  • Push wizard on remote repo
  • Create a development branch and click on it.

All this is done without git installed using ngit (the .NET port for jgit).

But I canโ€™t understand how to set up tracking to track the origin / master wizard and evolve to source / development using only ngit.

I can do it easily with

git branch --set-upstream master origin/master

However, I was hoping to avoid the dependency of a local git installation.

+5
1

Java, --set-upstream git branch:

Git git = Git.open(new File("/home/repos/myrepo"));
CreateBranchCommand create = git.branchCreate();
create.setUpstreamMode(SetupUpstreamMode.SET_UPSTREAM);
create.setName("develop");
create.setStartPoint("origin/develop");
create.call();
+6

All Articles