How to create master branch in remote repositories?

大兔子大兔子 提交于 2020-06-13 06:16:32

问题


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

  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

However, I can't see master branch in both C:\Test and D:\Test. How can I create a master branch? Thanks

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?


回答1:


As I explained in "Why do I need to explicitly push a new branch?", an initialized repository (bare or not) has 0 branch.

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.

Then: git push -u origin master will update the remote bare repository.



来源:https://stackoverflow.com/questions/62188120/how-to-create-master-branch-in-remote-repositories

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!