Skip to content

Instantly share code, notes, and snippets.

@mnutsch
Forked from oculushut/JGit
Last active March 20, 2020 20:14
Show Gist options
  • Select an option

  • Save mnutsch/e471d29517770edf413279dddfe384bc to your computer and use it in GitHub Desktop.

Select an option

Save mnutsch/e471d29517770edf413279dddfe384bc to your computer and use it in GitHub Desktop.

Revisions

  1. mnutsch revised this gist Mar 20, 2020. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion JGit
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,9 @@

    4. Type the following into the jgit.bat file:

    java -jar jgit.sh %*
    @echo off
    set jgitBatDir=%~dp0
    java -jar %jgitBatDir%jgit.sh %*

    5. The code inside the Main instance will look for arguments
    that are passed in during runtime. Here are the options:
  2. mnutsch revised this gist Mar 20, 2020. 1 changed file with 1 addition and 10 deletions.
    11 changes: 1 addition & 10 deletions JGit
    Original file line number Diff line number Diff line change
    @@ -8,16 +8,7 @@

    4. Type the following into the jgit.bat file:

    java -cp %~dp0\jgit.sh org.eclipse.jgit.pgm.Main %*
    //This will use java to look for the starting
    //point to start an application whose code is
    //held within the Main class which belongs to
    //the org.eclipse.jgit.pgm package. All this is
    //held within the jgit.sh file...
    //%* means "use all the arguments from command line prompt here".
    //%~dp0\ resolves to the folder that the batch script resides within
    //Add the jgit.bat file to the PATH environmental variable in Windows so that it can be called
    //from anywhere.
    java -jar jgit.sh %*

    5. The code inside the Main instance will look for arguments
    that are passed in during runtime. Here are the options:
  3. @oculushut oculushut revised this gist Mar 14, 2016. 1 changed file with 8 additions and 3 deletions.
    11 changes: 8 additions & 3 deletions JGit
    Original file line number Diff line number Diff line change
    @@ -16,6 +16,9 @@ java -cp %~dp0\jgit.sh org.eclipse.jgit.pgm.Main %*
    //held within the jgit.sh file...
    //%* means "use all the arguments from command line prompt here".
    //%~dp0\ resolves to the folder that the batch script resides within
    //Add the jgit.bat file to the PATH environmental variable in Windows so that it can be called
    //from anywhere.

    5. The code inside the Main instance will look for arguments
    that are passed in during runtime. Here are the options:

    @@ -75,14 +78,16 @@ Don't get caught out by not including the permissions for the bucket as well as

    10. Within your git repo, use regular git to create a remote which points to the S3 bucket. E.g.:

    git remote add s3 amazon-s3://secret@foo.gitrepos/
    git remote add s3 amazon-s3://secret@foo.gitrepos/repo

    If you want to amend the URL later then just use the set-url command:

    git remote set-url s3 amazon-s3://secret@foo.gitrepos/
    git remote set-url s3 amazon-s3://secret@foo.gitrepos/repo

    11. Push up to bucket with jgit!

    jgit push s3 refs/heads/master

    (Not working yet...)
    12. To clone on another machine with jgit...

    jgit clone amazon-s3://secret@foo.gitrepos/repo
  4. @oculushut oculushut revised this gist Mar 13, 2016. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions JGit
    Original file line number Diff line number Diff line change
    @@ -67,6 +67,12 @@ You can get the accesskey and secretkey info from your AWS account.

    Place this file in your Windows user folder... e.g. C:\Users\[username]

    Make sure the user account you are using has all the appropriate permissions! In particular, check out these examples:

    http://blogs.aws.amazon.com/security/post/Tx3VRSWZ6B3SHAV/Writing-IAM-Policies-How-to-grant-access-to-an-Amazon-S3-bucket

    Don't get caught out by not including the permissions for the bucket as well as the content of the bucket!!

    10. Within your git repo, use regular git to create a remote which points to the S3 bucket. E.g.:

    git remote add s3 amazon-s3://secret@foo.gitrepos/
  5. @oculushut oculushut revised this gist Mar 13, 2016. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion JGit
    Original file line number Diff line number Diff line change
    @@ -65,11 +65,13 @@ acl: private

    You can get the accesskey and secretkey info from your AWS account.

    Place this file in your Windows user folder... e.g. C:\Users\[username]

    10. Within your git repo, use regular git to create a remote which points to the S3 bucket. E.g.:

    git remote add s3 amazon-s3://secret@foo.gitrepos/

    You can use something like this if you type the URL incorrectly
    If you want to amend the URL later then just use the set-url command:

    git remote set-url s3 amazon-s3://secret@foo.gitrepos/

  6. @oculushut oculushut created this gist Mar 13, 2016.
    80 changes: 80 additions & 0 deletions JGit
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,80 @@
    1. Download jgit.sh from here: https://eclipse.org/jgit/download/

    (Yes -> it's a file with a .sh extension and we want to work in Windows, but download it!)

    2. Rename the downloaded file to something easier to deal with. E.g. "jgit.sh"

    3. Create a new file called jgit.bat and stick it in the same folder as jgit.sh.

    4. Type the following into the jgit.bat file:

    java -cp %~dp0\jgit.sh org.eclipse.jgit.pgm.Main %*
    //This will use java to look for the starting
    //point to start an application whose code is
    //held within the Main class which belongs to
    //the org.eclipse.jgit.pgm package. All this is
    //held within the jgit.sh file...
    //%* means "use all the arguments from command line prompt here".
    //%~dp0\ resolves to the folder that the batch script resides within
    5. The code inside the Main instance will look for arguments
    that are passed in during runtime. Here are the options:

    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
    branch List, create, or delete branches
    checkout Checkout a branch to the working tree
    clone Clone a repository into a new directory
    commit Record changes to the repository
    config Get and set repository or global options
    daemon Export repositories over git://
    describe Show the most recent tag that is reachable from a commit
    diff Show diffs
    fetch Update remote refs from another repository
    gc Cleanup unnecessary files and optimize the local repository
    init Create an empty git repository
    log View commit history
    ls-remote List references in a remote repository
    ls-tree List the contents of a tree object
    merge Merges two development histories
    push Update remote repository from local refs
    reflog Manage reflog information
    repo Parse a repo manifest file and add submodules
    reset Reset current HEAD to the specified state
    rm Stop tracking a file
    show display one commit
    status Show the working tree status
    tag Create a tag
    version Display the version of jgit

    7. E.g. you can now execute the following to get the version!

    F:\#Downloads\JGit>jgit version
    F:\#Downloads\JGit>java -cp jgit.sh org.eclipse.jgit.pgm.Main version
    jgit version 4.2.0.201601211800-r

    8. Add the folder that you have created the jgit.bat file into your PATH environmental variable

    9. Now create a new file called "secret" and add in the following info from your AWS account:

    accesskey: XXXXXXXXXXXX
    secretkey: XXXXXXXXXXXX
    acl: private

    You can get the accesskey and secretkey info from your AWS account.

    10. Within your git repo, use regular git to create a remote which points to the S3 bucket. E.g.:

    git remote add s3 amazon-s3://secret@foo.gitrepos/

    You can use something like this if you type the URL incorrectly

    git remote set-url s3 amazon-s3://secret@foo.gitrepos/

    11. Push up to bucket with jgit!

    jgit push s3 refs/heads/master

    (Not working yet...)