在 Android 上提交 window Studio 说 "bad config line 12 in file .git/config"

Commit window on Android Studio says "bad config line 12 in file .git/config"

我最近将我的 github 存储库从 public 切换为私有。这样做,新的提交 "went through" 但没有出现在回购协议中;相反,当我 "open on Github." 我意识到这可能是因为我的标签仅限于 "HEAD" 和 "master" 并且缺少 "origin/master" 时出现了 404 错误。这是我尝试过的:

git init
git checkout -B master origin/master
fatal: 'origin/master' is not a commit and a branch 'master' cannot be created from it

我回到我的 Android Studio 项目,它说 "bad config line 12 in file .git/config" 所以这就是我怀疑的问题(在记事本中):

[remote "origin"] //line 8
url = https://github.com/user/applicationname.git //not the actual url, but I know this line is fine
fetch = +refs/heads/*:refs/remotes/origin/*[branch "master"]  

remote = origin //line 12
merge = refs/heads/master

其中 remote = origin 是第 12 行。我还仔细检查了目录:

git rev-parse --git-dir
.git

public我推了几次。我仍然可以通过版本控制打开以前提交的网页:日志。

看起来您在 [branch "master"] 之前仍然缺少换行符。没有它,看起来您正在尝试为 [remote] 设置一个 remote,我猜您不能。括号中的内容应该开始一个新的部分,但由于缺少换行符,它反而破坏了 fetch = 设置的值,该设置应该是上一行。

[remote "origin"]
url = https://github.com/user/applicationname.git
fetch = +refs/heads/*:refs/remotes/origin/*

[branch "master"]  
remote = origin
merge = refs/heads/master