I've been wracking my brain over this and came to a possible conclusion with no solution. First, my dilemma.
I have a project where I can create a repo programmatically. I can edit the description of the repo, set the default branch, &c. This is fine.
I am also using git daemon
to serve the folder where all the generated repos are kept. Here's where the issue steps in.
I am able to clone the repo but the cloned repo's .git
contents don't match the original repo.
The only thing I can think of is that when I am creating these repos I am using my system's git process but when cloning I am using the git daemon
's process...I'm not even sure that makes sense and my hours of searching have turned up nothing.
For reference, here's the command I run to activate git daemon
:
git daemon --reuseaddr --port=9999 --base-path=/Users/me/repos/ --export-all --verbose --enable=receive-pack --informative-errors --detach
Here's an example of a clone command:
git clone git://localhost:9999/me/test18.git
And here are the commands I run to create the repos:
git init
git remote add origin git://localhost:9999/me/repo.git
git symbolic-ref HEAD refs/heads/magic
# more stuff
These things work, I just need git daemon
to serve my repos the way they are.
Here's an example of the contents of .git/config
in the repo I create:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = git://localhost:9999/me/repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "coolerbranch"]
remote = origin
merge = refs/heads/coolerbranch
Here is that same repo cloned:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = git://localhost:9999/me/repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
As you can see, the [branch ...]
section doesn't match.
Conversely, if there's another git daemon
out there that I haven't found I'd love to hear about it. Github had been working on their own several years ago but abandoned it.
Also, I originally posted this question on SO but after further searching on other SE sites, I realized SF has more git-daemon
-esque questions.
Cloning a repo doesn't copy the configuration. Configuration is mostly local to the computer, user, or directory.
Without this knowledge, I was assuming there'd be a way to get git to sync the initial config upon cloning. Git's defaults are not overrideable by a server, only by the user.
Maybe git will allow this option someday, most likely not. Ah well.