“git init”失败了,怎么了? [英] "git init" failed, what's wrong?

查看:356
本文介绍了“git init”失败了,怎么了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题与糟糕的git配置文件.git / config ,因为它在使用 git init 时失败了。



看起来/ home /镜像/ .gitconfig:

  [mirror @ home php] $ git init 
错误:push.default格式错误:简单
错误:必须是无,匹配,跟踪或当前之一。
致命:在/home/mirror/.gitconfig中配置文件第8行

这是〜/ .gitignore的内容:

  cat〜/ .gitconfig 
[别名]
lg =日志--graph --pretty =格式:'%Cred%h%Creset - %C(黄色)%d%Creset%s%Cgreen(%cr)%C(粗体蓝色)<%an>%Creset' - -abbrev-commit --date = relative
[user]
email = xxxxxx@gmail.com
name = xxxxx
[push]
default = simple


解决方案

简单是在git v1.7.11中添加的。如果您的git版本较旧,则此选项不存在。只需将它从您的conf中删除,您就可以初始化回购。



请参阅 https://raw.github.com/git/git/master/Documentation/RelNotes/1.7.11.txt p>

This issue is not same as "Bad git config file .git/config", since it failed when using git init.

It seems there is nothing wrong with /home/mirror/.gitconfig:

[mirror@home php]$ git init
error: Malformed value for push.default: simple
error: Must be one of nothing, matching, tracking or current.
fatal: bad config file line 8 in /home/mirror/.gitconfig

This is the content of ~/.gitignore:

cat ~/.gitconfig
[alias]
        lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
[user]
        email = xxxxxx@gmail.com
        name = xxxxx
[push]
        default = simple

解决方案

Simple was added in git v1.7.11. If your git version is older, this option doesn't exist. Simply remove it from your conf and you'll be able to init repos.

See https://raw.github.com/git/git/master/Documentation/RelNotes/1.7.11.txt

这篇关于“git init”失败了,怎么了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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