fatal: Not a valid object name: 'master'

前端 未结 4 1747
故里飘歌
故里飘歌 2020-12-02 05:21

I have a private server running git 1.7 When I

git init 

a folder it doesn\'t create a master branch. Cause when i do:

gi         


        
4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-02 05:49

    When I git init a folder it doesn't create a master branch

    This is true, and expected behaviour. Git will not create a master branch until you commit something.

    When I do git --bare init it creates the files.

    A non-bare git init will also create the same files, in a hidden .git directory in the root of your project.

    When I type git branch master it says "fatal: Not a valid object name: 'master'"

    That is again correct behaviour. Until you commit, there is no master branch.

    You haven't asked a question, but I'll answer the question I assumed you mean to ask. Add one or more files to your directory, and git add them to prepare a commit. Then git commit to create your initial commit and master branch.

提交回复
热议问题