WILLIAM
WILLIAM

Reputation: 485

How to create master branch in remote repositories?

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?

Upvotes: 1

Views: 1338

Answers (1)

VonC
VonC

Reputation: 1327384

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.

Upvotes: 1

Related Questions