Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] question about creating remote repos

On Mon, Sep 19, 2011 at 07:33, Arthur grohe <Arthur.Grohe@xxxxxxx> wrote:
> I want to use jGit in my java project to create a remote repo
> with a predefined structure.
>
> I was able to create a local repo with the following code:
>                RepositoryBuilder repBuild = new RepositoryBuilder();
>                Repository repo = null;
>                try {
>                        repo = repBuild.setGitDir(new File("/my/git/dir"))
>                        .readEnvironment()
>                        .findGitDir()
>                        .build();
>
>                        repo.create();
>                } catch (IOException e) {
>                        e.printStackTrace();
>                }
>
> Two things I want to know:
> 1. How can I create a remote repository?

You have to do this outside of the current process. For example, login
to the remote system and run `git init`.

> 2. How can I push/fill that repo with my folder-structure?

Use the PushCommand, e.g. new Git(repo).push()....call(). You will
need to configure the command with the remote repository URL, and the
references you want to push.

-- 
Shawn.


Back to the top