如何在远程存储库中创建master分支? [英] How to create master branch in remote repositories?
问题描述
创建裸仓库时遇到问题.这是我的步骤:
I encounter an issue when I create a bare repository. Here is my step:
- 在
C:\
中创建一个名为Test
的文件夹作为远程存储库 - 在sourcetree中创建存储库,然后选择
C:\Test
- 在终端中输入命令
git init --bare
- 将
C:\Test
克隆到我的本地文件夹D:\Test
- Create a folder named
Test
in aC:\
as a remote repository - Create repository in sourcetree and select
C:\Test
- Input command
git init --bare
in terminal - Clone
C:\Test
to my local folderD:\Test
但是,我在C:\Test
和D:\Test
中都看不到master分支.如何创建主分支?谢谢
However, I can't see master branch in both C:\Test
and D:\Test
. How can I create a master branch? Thanks
PS:我的C:\Test
具有挂钩,信息,对象,引用,配置,描述,HEAD.我需要检入它们并使它们成为主分支吗?
PS: my C:\Test
has hooks, info, objects, refs, config, description, HEAD. Do I need to check in them and make them as master branch?
推荐答案
正如我在"中解释的为什么新分支?",已初始化的存储库(不考虑裸机与否)具有0个分支.
As I explained in "Why do I need to explicitly push a new branch?", an initialized repository (bare or not) has 0 branch.
您需要在非裸存储库D:\Test
中创建,添加和提交文件,以便创建任何分支(默认情况下为master分支).
您可以在此处看到示例.
You need, in the non-bare repository D:\Test
, to create, add and commit a file, in order for any branch (here the master branch by default) to be created.
You can see an example here.
然后:git push -u origin
主服务器将更新远程裸仓库.
Then: git push -u origin
master will update the remote bare repository.
这篇关于如何在远程存储库中创建master分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!