致命的:不是有效的对象名称:'主' [英] fatal: Not a valid object name: 'master'

查看:137
本文介绍了致命的:不是有效的对象名称:'主'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行git 1.7
的私人服务器当我

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:

git branch 

它没有列出任何东西。
当我这样做时:

it doesn't list anything. When I do:

git --bare init

它创建文件。
当我输入

it creates the files. When I type

git branch master 

它表示:

it says:

fatal: Not a valid object name: 'master'.


推荐答案


c $ c> git init 它不创建master分支的文件夹

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.


当我做的时候,Git不会创建 master 分支。 git --bare init 它会创建文件。

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

git init 也会在项目根目录下隐藏的 .git 目录中创建相同的文件。

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


当我键入 git branch master 时,它会显示致命的:不是有效的对象名称: 'master'

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.

您没有提出任何问题,但我会回答我提出的问题意思是问。将一个或多个文件添加到您的目录,然后添加 git add 来准备提交。然后 git commit 来创建你的初始提交和 master 分支。

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.

这篇关于致命的:不是有效的对象名称:'主'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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