create a git symbolic ref in remote repository

2020-03-01 07:26发布

问题:

In my remote bare repository the HEAD is pointing to "refs/heads/master" and I want it to point to "refs/heads/other".

I am not able to go to remote repository directory and run git symbolic-ref. Is there any git command to achieve it? Or any other way?

If there is no way, does Github allow one to change the HEAD?

Thanks in advance.

回答1:

To change it in github, go to the admin section.
You can select the default branch from a dropdown there.



回答2:

(There has been posted another question asking basically the same: How do I change a Git remote HEAD to point to something besides “master”, and there was more discussion there, with a reference to the Github group. So I'd just like to point anyone to that discussion as well.)

As we know, there is no universal answer.

But there are a specific answers for various git "farms" (where multiple users can manage git repos through a restricted interface: via http and ssh): http://Github.com, http://Gitorious.org, http://repo.or.cz, Girar (http://git.altlinux.org).

These specific answers might be useful for those reading this page and thinking about these specific services.

  • Now they have a drop-down menu for selecting the HEAD branch at http://repo.or.cz (example: http://repo.or.cz/editproj.cgi?name=for-me-and-for-all_imz.git);
  • and at http://gitorious.org, too (look somewhere in the settings);
  • and at http://GitHub.com: admin > Default Branch > (choose something) (thanks to @srcspider's answer);
  • and in Girar (running on http://git.altlinux.org to build packages for ALT's distro), one can the ssh interface for this:
$ ssh git.alt help | fgrep branch
default-branch  []
$ 

for example ssh git.alt default-branch packages/autosshd.git sisyphus to change the HEAD in the remote repo autosshd.git to point to the sisyphus branch.