在远程存储库中创建一个git symbolic ref

时间:2022-11-19 16:25:15

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

在我的远程裸存储库中,HEAD指向“refs / heads / master”,我希望它指向“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?

我无法进入远程存储库目录并运行git symbolic-ref。是否有任何git命令来实现它?还是其他任何方式?

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

如果没办法,Github是否允许改变HEAD?

Thanks in advance.

提前致谢。

2 个解决方案

#1


6  

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

要在github中更改它,请转到管理部分。您可以从下拉列表中选择默认分支。

#2


4  

(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.)

(已经发布了另一个问题基本相同:如何更改Git远程HEAD以指向除“master”之外的东西,并且那里有更多的讨论,并引用了Github组。所以我只是喜欢指出任何人也参与讨论。)

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).

但是对于各种git“farm”有一个特定的答案(多个用户可以通过受限制的界面管理git repos:通过http和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);
  • 现在,他们有一个下拉菜单,用于在http://repo.or.cz上选择HEAD分支(例如: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);
  • 在http://gitorious.org上(看看设置中的某个地方);
  • and at http://GitHub.com: admin > Default Branch > (choose something) (thanks to @srcspider's answer);
  • 并在http://GitHub.com:admin>默认分支>(选择一些东西)(感谢@ srcspider的回答);
  • and in Girar (running on http://git.altlinux.org to build packages for ALT's distro), one can the ssh interface for this:
  • 在Girar(运行在http://git.altlinux.org上为ALT的发行版构建软件包),可以使用ssh接口:
$ 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.

例如ssh git.alt default-branch packages / autosshd.git sisyphus将远程repo autosshd.git中的HEAD更改为指向sisyphus分支。

#1


6  

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

要在github中更改它,请转到管理部分。您可以从下拉列表中选择默认分支。

#2


4  

(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.)

(已经发布了另一个问题基本相同:如何更改Git远程HEAD以指向除“master”之外的东西,并且那里有更多的讨论,并引用了Github组。所以我只是喜欢指出任何人也参与讨论。)

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).

但是对于各种git“farm”有一个特定的答案(多个用户可以通过受限制的界面管理git repos:通过http和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);
  • 现在,他们有一个下拉菜单,用于在http://repo.or.cz上选择HEAD分支(例如: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);
  • 在http://gitorious.org上(看看设置中的某个地方);
  • and at http://GitHub.com: admin > Default Branch > (choose something) (thanks to @srcspider's answer);
  • 并在http://GitHub.com:admin>默认分支>(选择一些东西)(感谢@ srcspider的回答);
  • and in Girar (running on http://git.altlinux.org to build packages for ALT's distro), one can the ssh interface for this:
  • 在Girar(运行在http://git.altlinux.org上为ALT的发行版构建软件包),可以使用ssh接口:
$ 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.

例如ssh git.alt default-branch packages / autosshd.git sisyphus将远程repo autosshd.git中的HEAD更改为指向sisyphus分支。