git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Change default branch name (server side) while cloning a repository

From
Garbageyard <varuag.chhabra@gmail.com>
Date
Mar 27, 2015, 12:27 UTC
Message-ID
<1427459241861-7627964.post@n2.nabble.com>

We use Gitolite for access control and i have admin access on Git server. I wanted to make sure that whenever a new repository is created and is then cloned on any machine, the default branch should point to mainline. To do this, when I run the repository creation script, i change the content of file HEAD of a given repository to point to mainline i.e., default entry of “ref: refs/heads/master” in file HEAD is changed to “ref: refs/heads/mainline”.

For example, if "work" is the repository name, then on Git server,
[gitolite@gitserver  repositories]$ cd work.git/

[gitolite@gitserver work.git]$ cat HEAD ref: refs/heads/mainline

If i now clone the repository on my local machine, then the default branch should be pointing to mainline and not master. However, the issue is that it still points to master. Am I /wrong/ in assuming that changing the entry in file HEAD for a given repository on Git server will change the default branch while cloning? If I’m wrong, can anyone please tell me how can I enforce this change on the /server/ side correctly?

-- View this message in context: http://git.661346.n2.nabble.com/Change-default-branch-name-server-side-while-cloning-a-repository-tp7627964.html Sent from the git mailing list archive at Nabble.com.

Next: Stefan Näwe
Message 1 of 4 in “Change default branch name (server side) while cloning a repository”
  1. GarbageyardMar 27, 2015
  2. Stefan NäweMar 27, 2015
  3. Jeff KingMar 27, 2015
  4. Matthieu MoyMar 27, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.