【发布时间】:2026-01-12 01:05:02
【问题描述】:
git init --bare test-repo.git
cd test-repo.git
(文件夹是用 git-ish 文件和文件夹创建的)
git status
致命:此操作必须在工作树中运行 (好的,所以我不能将 git status 与裸仓库一起使用;我猜是有道理的)
git branch
(什么都没有,看起来裸仓库不包含任何分支。我必须从克隆的仓库中添加它们吗?)
cd ..
mkdir test-clone
cd test-clone
git clone ../test-repo.git
(我收到有关克隆空存储库的警告)
cd test-repo
(提示改变以表明我在 master 分支上)
git branch
(没有显示结果 - 嗯?)
git branch master
致命:不是有效的对象名称:'master'
嗯。那么如何在我的裸仓库中创建 master 分支呢?
【问题讨论】:
标签: git git-branch git-bare