Questions tagged [jgit]

JGit is an EDL (new-style BSD) licensed, lightweight, pure Java library implementing the Git version control system.

JGit is an EDL (new-style BSD) licensed, lightweight, pure Java library implementing the version control system.

It is developed as part of the Eclipse Git Plugin .

JGit Supports:

  • Repository access routines
  • Network protocols
  • Core version control algorithms
  • Implementation of many porcelain commands
  • tasks for performing Git operations as part of automated builds
  • A Git daemon to provide a simple Git server
  • A jgit commandline tool for working with Git repositories

For details visit the Project page or the User Guide, there is also API Documentation available.

The community-provided jgit-cookbook provides ready-to-run snippets that show how things can be achieved when using JGit

956 questions
85
votes
6 answers

Confusion in choosing between JavaGit, JGit and EGit

I am making a Java application that uses Git. I found that there is something called JavaGit, EGit and JGit. I know that JavaGit and EGit/JGit are different. What I don't understand is the difference between EGit and JGit. Both are hosted on Eclipse…
Jus12
  • 17,824
  • 28
  • 99
  • 157
31
votes
7 answers

How to "cat" a file in JGit?

A while back I was looking for an embeddable distributed version control system in Java, and I think I have found it in JGit, which is a pure Java implementation of git. However, there is not much in the way of sample code or tutorials. How can I…
Thilo
  • 257,207
  • 101
  • 511
  • 656
30
votes
5 answers

JGit and finding the Head

I'm trying to get my hands on the HEAD commit with JGit: val builder = new FileRepositoryBuilder() val repo = builder.setGitDir(new File("/www/test-repo")) .readEnvironment() .findGitDir() .build() val walk: RevWalk = new RevWalk(repo,…
Tower
  • 98,741
  • 129
  • 357
  • 507
28
votes
4 answers

JGit: Checkout a remote branch

I'm using JGit to checkout a remote tracking branch. Git binrepository = cloneCmd.call() CheckoutCommand checkoutCmd = binrepository.checkout(); checkoutCmd.setName( "origin/" +…
Nambi
  • 2,688
  • 8
  • 28
  • 37
27
votes
2 answers

How do I do git push with JGit?

I'm trying to build a Java application that allows users to use Git based repositories. I was able to do this from the command-line, using the following commands: git init git add . git commit git remote add
John Smith
  • 511
  • 1
  • 7
  • 14
27
votes
2 answers

Shallow clone with JGIT

How I can do git clone --depth 1 ... with JGIT library?
Timothy Klim
  • 1,257
  • 15
  • 25
26
votes
2 answers

Why is not recommended to have an Eclipse project folder as a Git repository?

When sharing a project as git and trying to make the Eclipse project folder as the git repository, Eclipse says that it is not recommended to do so and that it should be outside the Eclipse workspace. Why is that?
David Hofmann
  • 5,683
  • 12
  • 50
  • 78
24
votes
4 answers

Is it possible to slim a .git repository without rewriting history?

We have a number of git repositories which have grown to an unmanageable size due to the historical inclusion of binary test files and java .jar files. We are just about to go through the exercise of git filter-branching these repositories,…
Mark Booth
  • 7,605
  • 2
  • 68
  • 92
22
votes
11 answers

Teamcity to github List remote refs failed not authorized jgit

Using github for windows on same machine, with same credentials works fine. Can pull/clone. However teamcity installed as a windows service on the same machine, returns the following error List remote refs failed:…
NimChimpsky
  • 46,453
  • 60
  • 198
  • 311
21
votes
4 answers

jGit - how to add all files to staging area

I tried in a lot of ways to clone a repo with jGit (it works). Then, I write some archive in the repository, and tried to add all (a git add *, git add -A or something like it).. but it don't work. The files simple are not added to the staging…
caarlos0
  • 20,020
  • 27
  • 85
  • 160
21
votes
1 answer

What is the meaning of pull strategy when creating a branch with egit?

In EGit when I got to Team > Switch to > New branch I end up with the dialog box below. What is the meaning of the various pull strategies listed on this dialog box?
ams
  • 60,316
  • 68
  • 200
  • 288
20
votes
3 answers

Add remote via JGit

I playing around JGit, I could successfully remove a remote from some repository (git remote rm origin), how can I do a git remote add origin http://github.com/user/repo ? To remove I do the following: StoredConfig config =…
caarlos0
  • 20,020
  • 27
  • 85
  • 160
18
votes
2 answers

JGit how do i get the SHA1 from a RevCommit?

This seems like an idiotic question, but I can't find documentation on it anywhere. How do I get a the SHA1 of a RevCommit object?
c2knaps
  • 1,817
  • 17
  • 23
17
votes
2 answers

Egit hooks do not get triggered

I have a git repo with a pre-commit hook that intentionally fails 100% of the time. cat .git/hooks/pre-commit > exit 1 If I try to commit through the command line, it fails as expected. However, if I commit from egit, the hook is ignored and the…
Ken Hirakawa
  • 7,831
  • 10
  • 38
  • 49
17
votes
1 answer

How to use JGit to get the URL of origin?

How to use JGit to get the URL of the origin remote? I am using JGit and I want to execute git config --get remote.origin.url How to do that?
hannsworst
  • 291
  • 2
  • 11
1
2 3
63 64