如何在远程存储库中创建master分支? [英] How to create master branch in remote repositories?

查看:554
本文介绍了如何在远程存储库中创建master分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建裸仓库时遇到问题.这是我的步骤:

I encounter an issue when I create a bare repository. Here is my step:

  1. C:\中创建一个名为Test的文件夹作为远程存储库
  2. 在sourcetree中创建存储库,然后选择C:\Test
  3. 在终端中输入命令git init --bare
  4. C:\Test克隆到我的本地文件夹D:\Test
  1. Create a folder named Test in a C:\ as a remote repository
  2. Create repository in sourcetree and select C:\Test
  3. Input command git init --bare in terminal
  4. Clone C:\Test to my local folder D:\Test

但是,我在C:\TestD:\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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆