Re: Cloning empty repositories, was Re: What is the idea for bare repositories?
- From
Brian Gernhardt <benji@silverinsanity.com>
- Date
- Nov 13, 2007, 19:50 UTC
- Message-ID
- <CBAEC42B-9F50-4723-9847-640D9832532E@silverinsanity.com>
- In-Reply-To
- <vpqpryefmhj.fsf@bauges.imag.fr>
On Nov 13, 2007, at 5:50 AM, Matthieu Moy wrote:
Show 8 quoted lines
> While clone normally does a bit more: > > [remote "origin"] > url = /tmp/git1/.git > fetch = +refs/heads/*:refs/remotes/origin/* > [branch "master"] > remote = origin > merge = refs/heads/master
But how is clone expected to do that when the origin is an empty repo? There is no branch for it to track, and automagically setting it to master is bogus because then it's tracking something that doesn't exist.
The easy way to set up the last bit is "git checkout -b master --track origin/master". But that won't work if origin/master doesn't exist. The following will always work:
git config branch.master.remote origin git config branch.master.merge refs/heads/master
But asking git-clone do do this sort of odd magic for an empty repo is dubious at best. Perhaps convenient for your situation, but creates repos that don't actually work. (Will give errors when trying to merge a non-existent branch, at the very least.)
~~ Brian