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:
- User configures repository in gitosis-admin [works already]
- User pushes changes to gitosis [works already]
- gitosis enables access to repository [works already]
- gitosis creates a repository from a stub (containing .gitignore, pom.xml, empty src/ directory) [NEEDS TO BE DONE]
- User clones repository. [works already]
- 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.
精彩评论