小编Phi*_*itl的帖子

将裸存储库上的 git 分支“master”重命名为“main”,无需在 GitHub 上搜索

我在服务器上有一个裸露的 git 存储库,其默认分支名为master. 我想把名字改成main.

当我搜索说明时,总是被告知在删除分支之前将defaultGitHub 上的分支更改为新分支。但我的仓库不在 GitHub 上。 当我尝试删除时,我收到此错误消息:mainmaster
master

$ git push origin --delete master
remote: error: By default, deleting the current branch is denied, because the next
remote: error: 'git clone' won't result in any file checked out, causing confusion.
remote: error: 
remote: error: You can set 'receive.denyDeleteCurrent' configuration variable to
remote: error: 'warn' or 'ignore' in the remote repository to allow deleting the
remote: error: current branch, with or …
Run Code Online (Sandbox Code Playgroud)

git

0
推荐指数
1
解决办法
1357
查看次数

标签 统计

git ×1