开发者

Auto creating repository from stub with gitosis

开发者 https://www.devze.com 2023-04-13 06:28 出处:网络
Using gitosis to configure repositories works quite well. However, manually creating every repository is quite cumbersome, especially as it has to be done on command line. (git init, git remote add,

Using gitosis to configure repositories works quite well.

However, manually creating every repository is quite cumbersome, especially as it has to be done on command line. (git init, git remote add, git commit, git push) As the majority of our projects are OSGi-Bundles, we can use almost the same repository layout and pom-file for each project. So instead of creating all this every time we have to create a new bundle i'd like to do something like this:

  1. User configures repository in gitosis-admin [works already]
  2. User pushes changes to gitosis [works already]
  3. gitosis enables access to repository [works already]
  4. gitosis creates a repository from a stub (containing .gitignore, pom.xml, empty src/ directory) [NEEDS TO BE DONE]
  5. User clones repository. [works already]
  6. User imports working copy into eclipse [works already]

Is there already a solution/common way to solve step 4? I'm currently thinking on using a git-hook to detect repository configuration. However, it seems that is may be necessary to parse the gitosis.conf file every time post-update is called.

Ideally, I'd like to use some git information to fill the pom.xml file (Repository-Name as artifactID, repository description as artifact descrip开发者_如何学运维tion, etc..)

Is there a more convenient/robust way to get information about configured but not yet created repositories?


You could create a template repository somewhere that looks like this:

$ ls -A
.gitignore
pom.xml
src/.gitignore
setup-remote

Then your workflow for new repositories looks like this:

  • Developer clones the template repository:

    $ git clone .../template.git my-new-repo
    
  • Developer runs the setup-remote script to configure access to the actual remote repository:

    $ cd my-new-repo
    $ ./setup-remote
    

And the setup-remote script takes care of:

git remote rm origin
git remote add origin .../my-new-repo.git
git push origin master

This presumes that Gitosis has been configured such that the developer can push to the remote repository.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号