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
5
votes
4 answers

How to use JGit with Maven

I'm new to GIT and want to use JGit to create repository and remove it beside other operations from a Java maven project. And I want to know what dependencies are needed for that. The following link what I read a bout JGit …
gasser
  • 279
  • 1
  • 4
  • 16
5
votes
2 answers

Get the default branch of a remote repository with JGit

I am working on a Git client, and right now I am trying to implement the checkout of a specific branch. I have a combo box that I populate with branch names, and I would like to find out which branch is the default, so that I can set it as the…
5
votes
1 answer

JGit: read the content of a file at a commit in a branch

I want to read the content of a file at a certain commit in a certain branch: I am currently, using this code to read the content of a file at a certain commit ignoring the branch. public static String readContentOfFileAtCommit(String commitStr,…
Master Mind
  • 3,014
  • 4
  • 32
  • 63
5
votes
2 answers

Clone git repository in-memory

I've been trying to clone a tiny git configuration repository into memory using JGIT and JIMFS using something like FileSystem fs = Jimfs.newFileSystem(Configuration.unix()); Path gitPath = Files.createDirectories(fs.getPath("/git"));…
Malt
  • 28,965
  • 9
  • 65
  • 105
5
votes
1 answer

gpg signing support for JGIT

I am using jgit for automation and I would like to ask if gpg signing is available on jgit. I haven't found an implementation yet on the net. If it still not available, can you recommend an implementation to automate gpg signing for git?
5
votes
1 answer

How to write git log --stat command in JGit

I have following git command: git log --stat=1000 --all > gitstat.log Is it possible to achieve this in JGit? If yes, what is the equivalent way to write this in JGit?
Maytham Fahmi
  • 31,138
  • 14
  • 118
  • 137
5
votes
3 answers

Push to GitLab with JGit authorization error

I am able to clone from GitLab via JGit, but when I go to push the changes, I get a not authorized error message. Three more essential details: I own the repository so it's not an issue with read-only access. The repository is private so I know…
user3817808
  • 187
  • 1
  • 10
5
votes
2 answers

JGit: RevWalk order overriding starting point

I'm using JGit for one of my project that involves intesive use of git. My aim is to use a RevWalk to be able to iterate over the commits in a repository in a chronological order, starting at a specifc commit. I've managed to achieve both of them…
vivianig
  • 173
  • 11
5
votes
1 answer

How to commit single files with JGit

even it is not recommended, I use for specific approach a: git commit -m 'xxxx' file 1 file2 Where both files, that are indexed and changed will be part of the commit. But not e.g. file3 and file4 that are changed too - but not named in the…
sqller
  • 59
  • 5
5
votes
2 answers

JGit pre-receive hook

When using JGit do a push to remote which is on the same server. 1) if the remote was configured with file:// or /path/to/git/remote, the pre-receive hook won't be executed. 2) if the remote was configured with ssh://, the pre-receive hook will be…
foolhunger
  • 345
  • 2
  • 12
5
votes
1 answer

Abort merge using JGit

This is pretty straightforward: How do I simulate the command git merge --abort in JGit? I need to "preview" the conflicts prior to the real merge
Fábio
  • 193
  • 12
5
votes
1 answer

maven jgitflow release-start goal changes line endings to CRLF

I'm working on Windows machine on a project which has line endings set to LF. After the command jgitflow:release-start is run, poms are update with new versions, but also line-endings in poms are changed to CRLF. Just to mention there is a line…
Marko Vranjkovic
  • 6,481
  • 7
  • 49
  • 68
5
votes
1 answer

Determine Tracking Branch in JGit

I would like to determine the remote tracking branch of HEAD using JGit. In straight git, I can do: git rev-parse --abbrev-ref --symbolic-full-name @{upstream} How can I do this in JGit?
Christian Goetze
  • 2,254
  • 3
  • 34
  • 51
5
votes
1 answer

IAM configuration to access jgit on S3

I am trying to create IAM permissions so jgit can access a directory in one of my buckets. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": ["s3:ListBucket"], "Resource":…
brechmos
  • 1,278
  • 1
  • 11
  • 22
5
votes
3 answers

jgit - Delete .git directory (or get files without it)

I need to clone a git repo in java. I am using jGit. The line of code I am using is : Git clone = Git.cloneRepository().setURI(URIofRepo).setDirectory(localPath).call(); Where URIofRepo is : the github link to my repo and Where localPath is : the…
Slippy
  • 1,253
  • 5
  • 22
  • 43