Need help getting started with JGit [message #1691478] |
Tue, 07 April 2015 14:04 |
Steve Cohen Messages: 46 Registered: July 2009 |
Member |
|
|
I would like to install JGit on a server where Git does not currently exist, and use its command-line interface to access a Git repository.
My first attempt then hits a brick wall:
The JGit User's Guide (https://wiki.eclipse.org/JGit/User_Guide) tells me:
Quote:Building the JGit CLI
Assuming that you have the EGit git repository cloned and ready, build the jgit binary by running the jgit maven build (see the Contributor Guide):
Well, you lost me right there. I don't have git on the machine. So that won't work.
I could build it on a machine where I do have git, but what is the URL from which to do the clone?
https://wiki.eclipse.org/EGit/Contributor_Guide#Builds tells me that the repo is at https://git.eclipse.org/r/jgit/jgit.git but I fail to connect there for some reason.
And I see there is a download page. http://www.eclipse.org/jgit/download/ Maybe that would help? Alas, not much. Here I find:
https://repo.eclipse.org/content/groups/releases//org/eclipse/jgit/org.eclipse.jgit/3.7.0.201502260915-r/org.eclipse.jgit-3.7.0.201502260915-r.jar
Sounds like what I want, but how do I use it on the command line? What setup is required?
I also find (among other goodies)
https://repo.eclipse.org/content/groups/releases//org/eclipse/jgit/org.eclipse.jgit.pgm/3.7.0.201502260915-r/org.eclipse.jgit.pgm-3.7.0.201502260915-r.sh
Ah, a shell script, sounds like what I am looking for. But no, this shell script is 3.7 MB long and contains binary stuff, unlike any shell script I've ever seen and it doesn't work, produces errors, and no documentation on what might be required to make it work. And the embedded binary code makes it un-viewable.
So, given my initial requirement
Quote:I would like to install JGit on a server where Git does not currently exist, and use its command-line interface to access a Git repository.
What is the best route to accomplish it?
Thank you.
|
|
|
Re: Need help getting started with JGit [message #1691897 is a reply to message #1691478] |
Fri, 10 April 2015 11:13 |
Christian Halstrick Messages: 274 Registered: July 2009 |
Senior Member |
|
|
You can either build JGit yourself:
/tmp> git clone https://git.eclipse.org/r/jgit/jgit
Cloning into 'jgit'...
remote: Counting objects: 2370, done
remote: Finding sources: 100% (667/667)
remote: Total 56257 (delta 34), reused 56106 (delta 34)
Receiving objects: 100% (56257/56257), 15.71 MiB | 538.00 KiB/s, done.
Resolving deltas: 100% (28062/28062), done.
Checking connectivity... done.
/tmp> cd jgit/
/tmp/jgit> mvn -q clean install -DskipTests
/tmp/jgit> java -jar org.eclipse.jgit.pgm/target/jgit-cli.jar
jgit --git-dir GIT_DIR --help (-h) --show-stack-trace --version command [ARG ...]
The most commonly used commands are:
add Add file contents to the index
archive zip up files from the named tree
...
Or you download a precompiled version (which comes in the form of a shell archive [1]):
/tmp> wget -O jgit.sh https://repo.eclipse.org/content/groups/releases//org/eclipse/jgit/org.eclipse.jgit.pgm/3.7.0.201502260915-r/org.eclipse.jgit.pgm-3.7.0.201502260915-r.sh
--2015-04-10 12:54:16-- https://repo.eclipse.org/content/groups/releases//org/eclipse/jgit/org.eclipse.jgit.pgm/3.7.0.201502260915-r/org.eclipse.jgit.pgm-3.7.0.201502260915-r.sh
Resolving proxy.wdf.sap.corp (proxy.wdf.sap.corp)... 147.204.6.136
Connecting to proxy.wdf.sap.corp (proxy.wdf.sap.corp)|147.204.6.136|:8080... connected.
Proxy request sent, awaiting response... 200 OK
Length: 3779156 (3,6M) [application/x-bsh]
Saving to: 'jgit.sh'
100%[================================================>] 3.779.156 538KB/s in 7,4s
2015-04-10 12:54:29 (497 KB/s) - 'jgit.sh' saved [3779156/3779156]
/tmp> chmod +x jgit.sh
/tmp> ./jgit.sh
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
jgit --git-dir GIT_DIR --help (-h) --show-stack-trace --version command [ARG ...]
The most commonly used commands are:
add Add file contents to the index
...
If you have to access the internet through a proxy make sure the environment variable http_proxy is set.
[1] http://en.wikipedia.org/wiki/Shar
Ciao
Chris
|
|
|
Powered by
FUDForum. Page generated in 0.03618 seconds