相关疑难解决方法(0)

坏git配置文件.git/config

在我的git存储库中,每当我执行任何类似git statusor的git命令时git log,我都会收到错误:
fatal: bad config file line 1 in .git/config
如何重建该文件或重新创建新文件?

git

33
推荐指数
6
解决办法
7万
查看次数

GIT:无法推送(奇怪的配置问题)

我正在全新安装Linux Mint.

尝试从任何存储库推送时,我收到以下错误:

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/leng/.gitconfig
fatal: Could not read from remote repository.
Run Code Online (Sandbox Code Playgroud)

这很奇怪,因为我肯定有一个支持简单推送行为的版本.

输出git --versiongit version 1.8.3.2.

内容~/.gitconfig:

[user]
    name = My Name
    email = MyEmail@website.com
[color]
    ui = true
[push]
    default = simple
Run Code Online (Sandbox Code Playgroud)

这是令人毛骨悚然的地方.

如果我改变行为matching(或nothing,tracking或者current,对于这个问题),然后尝试推,我得到完全相同的错误消息.怎么可能?是以某种方式缓存配置?我甚至尝试重启.我甚至尝试从系统中彻底清除GIT(并删除~/.gitconfig)然后重新安装它.

如果我[push]从.gitconfig文件中完全删除该部分(或者如果我完全删除该文件),那么尝试推送,然后我得到:

Git 2.0 from …
Run Code Online (Sandbox Code Playgroud)

linux git linux-mint

8
推荐指数
1
解决办法
3782
查看次数

如何设置一个git分支以推送到具有不同分支名称的远程并从完全不同的URL拉出

我的本地git repo需要从一台服务器上拉.然后,它需要将特定分支推送到具有不同服务器上的不同分支名称的审阅存储库.

类似于:从Server1上的PullOnlyRepo中拉出所有内容(我们可能会调用该来源吗?)将Branch分支修补程序推送到ReivewRepo,在Server2上使用分支名称JistChanges.

现在git config -l显示:

remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=<URL for Server1>
remote.origin.pushurl=no_push (this shouldn't matter since it is a pull only repo)
branch.production.remote=origin
branch.production.merge=refs/heads/production
remote.review.url=<URL for Server2>
remote.review.fetch=+refs/heads/*:refs/remotes/review/*
Run Code Online (Sandbox Code Playgroud)

git pull做我想要的(从Server1上的正确位置获取更改并将它们合并到我的工作树中).

但是git push没有.为了实现我想要的我必须做的事情

git push review hotfix:JistChanges
Run Code Online (Sandbox Code Playgroud)

是否有一些方法可以让git pull做到这一点,而不必添加额外的东西?

已经设置了一些问题,以便您的本地分支推送到具有不同分支名称的远程.然而,它们也改变了上游和拉动的来源.

git git-remote git-branch

7
推荐指数
1
解决办法
2586
查看次数

标签 统计

git ×3

git-branch ×1

git-remote ×1

linux ×1

linux-mint ×1