问题
I encounter an issue when I create a bare repository. Here is my step:
- 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
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