You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a new repository or forking a repository, the repo is created as --bare,
but not as --shared.
Personally I think all server hosted repos should be created with --shared, i.e. g+s
permissions under Unix. But it would be nice if we could at least have an option to
set when creating a new repository if it should be created as if created with git init
--bare --shared.
This would make it easier to use Gitblit in an environment where repository access
is not exclusively through Gitblit but Gitblit is rather used as an add-on to manage
repositories.
So, do you think you could work around that by directly setting the config variable
"core.sharedRepository" and maybe even "receive.denyNonFastForwards" with JGit Config
methods?
Yes, I can manipulate the repo config and I can use JNA to workaround Java 6 limitations
in setting unix filesystem permissions to emulate what you describe, but I'm not comfortable
making this change for the next release which should be out in a day or two.
If you need this now then I recommend creating the repos from outside Gitblit and clearing
Gitblit's cache afterwards so that it sees your new repo(s).
You want --shared because you are cloning/pushing these repos with file:// urls, right?
BTW, while I can set "receive.denyNonFastForwards" for other Git tooling, Gitblit does
not respect this setting.
No, I want shared because I use Gitblit for creating/forking repositories but not as
the exclusive access control tool. Access is also through Apache and via SSH. So all
repositories are owned by the git group and g+s.
James, could you give me some pointers to the code I should be looking at in order to
"manipulate the repo config" and "use JNA to workaround Java 6 limitations in setting
unix filesystem permissions"? I would like to start working on this as it is my next
most pressing issue for our installation.
JNA is already a dependency so this should be less painful.
Below is half of what you want - setting the sharedRepository flag - and a hint on
how to do the remainder. The linked CLibrary api may not be the correct one. The
basic plan is to set the repo config and file system permissions after the repository
is init'd, since JGit doesn't support --shared.
JGitUtils.createRepository() {
try {
Git git = Git.init().setDirectory(new File(repositoriesFolder, name)).setBare(true).call();
boolean isWindows = System.getProperty("os.name").toLowerCase().indexOf("windows")
> -1;
if (!isWindows) {
StoredConfig config = git.getRepository().getConfig();
config.setBoolean("core", null, "sharedRepository", true);
config.save();
// JNA here
// http://stackoverflow.com/a/664453/830200
}
return git.getRepository();
} catch (IOException e) {
throw new RuntimeException(e);
} catch (GitAPIException e) {
throw new RuntimeException(e);
}
}
Activity
gitblit commentedon Aug 12, 2015
Reported by
James.Mogeron 2013-07-02 15:57:27gitblit commentedon Aug 12, 2015
Reported by
f.zschockeon 2013-07-03 12:52:17gitblit commentedon Aug 12, 2015
Reported by
James.Mogeron 2013-07-03 13:32:17gitblit commentedon Aug 12, 2015
Reported by
f.zschockeon 2013-07-03 13:45:57gitblit commentedon Aug 12, 2015
Reported by
f.zschockeon 2013-08-12 18:12:31gitblit commentedon Aug 12, 2015
Reported by
James.Mogeron 2013-08-12 18:44:15gitblit commentedon Aug 12, 2015
Reported by
James.Mogeron 2013-09-17 21:57:21Queuedgitblit commentedon Aug 12, 2015
Reported by
James.Mogeron 2014-03-09 18:06:21Done