2

我是一个新的 git 和 GitHub 用户。我已经使用 GitHub for windows 有一段时间了,但想在学习如何在我想要改进的 repo 上分叉和提交拉取请求的同时尝试更多的命令行。

我所看到的是“上游”似乎被定义为不可用,我想了解发生了什么。我想当我想请求将我的更改拉入上游存储库时,这将是一个问题。


我在 GitHub 上 fork存储库,然后将其克隆到我的计算机上:

git clone https://github.com/mrwweb/CPT-Descriptions.git

然后我进入新的存储库并尝试添加分叉教程中列出的上游:

git remote add upstream https://github.com/vanpop/CPT-Descriptions.git

这给了我错误:

致命:远程上游已经存在。

当我尝试:git fetch upstream时,我得到了这个:

致命:“上游”似乎不是 git 存储库

致命:无法读取远程存储库。

请确保您具有正确的访问权限并且存储库存在。

我已经阅读了其他建议编辑我的 git 配置文件的线程,但其中没有提到上游:

[核]

存储库格式版本 = 0

文件模式 = 假

裸=假

logallrefupdates = 真

符号链接 = 假

忽略大小写 = 真

hideDotFiles = dotGitOnly

[遥远的“起源”]

网址 = https://github.com/mrwweb/CPT-Descriptions.git

fetch = +refs/heads/ :refs/remotes/origin/

[分支“主”]

远程=原点

合并=参考/负责人/主人

最后,当我尝试时,git remote -v我得到了这个:

来源 https://github.com/mrwweb/CPT-Descriptions.git (fetch)

来源 https://github.com/mrwweb/CPT-Descriptions.git(推送)

上游

========================

更新:添加结果git config -l

core.symlinks=false core.autocrlf=true core.editor=gitpad

color.diff=auto color.status=auto color.branch=auto

color.interactive=true color.ui=true pack.packsizelimit=2g

help.format=html http.sslcainfo=/bin/curl-ca-bundle.crt

sendemail.smtpserver=/bin/msmtp.exe

diff.astextplain.textconv=astextplain rebase.autosquash=true

credential.helper=!github --credentials filter.ghcleansmudge.clean=cat

filter.ghcleansmudge.smudge=cat push.default=upstream

alias.dt=difftool alias.mt=mergetool diff.tool=vs11

difftool.prompt=false difftool.bc4.cmd="c:/program files (x86)/beyond

比较 3/bcomp.exe" "$LOCAL" "$REMOTE" difftool.p4.cmd="c:/program

文件/Perforce/p4merge.exe" "$LOCAL" "$REMOTE"

difftool.vs11.cmd="c:/program files (x86)/microsoft visual studio

11.0/common7/i de/devenv.exe" '//diff' "$LOCAL" "$REMOTE" merge.tool=bc3 mergetool.prompt=false mergetool.keepbackup=false

mergetool.bc3.cmd="c:/program files (x86)/beyond compare 3/bcomp.exe"

"$LOCAL" "$REMOTE" "$BASE" "$MERGED" mergetool.bc3.trustexitcode=true

mergetool.p4.cmd="c:/program files/Perforce/p4merge.exe" "$BASE"

"$LOCAL" "$REMO TE" "$MERGED" 合并工具.p4.trustexitcode=false

remote.origin.fetch=+refs/heads/ :refs/remotes/origin/

remote.origin.fetch=+refs/pull/ /head:refs/remotes/origin/pr/

remote.upstream.fetch=+refs/heads/ :refs/remotes/upstream/

remote.upstream.fetch=+refs/pull/ /head:refs/remotes/upstream/pr/

user.name=mrwweb user.email=info@mrwweb.com core.autocrlf=true

core.repositoryformatversion=0 core.filemode=false core.bare=false

core.logallrefupdates=true core.symlinks=false core.ignorecase=true

core.hidedotfiles=dotGitOnly

remote.origin.url= https://github.com/mrwweb/CPT-Descriptions.git

remote.origin.fetch=+refs/heads/ :refs/remotes/origin/

branch.master.remote=起源 branch.master.merge=refs/heads/master

4

2 回答 2

3

经过大量的故障排除(谢谢@alex_sf),我相信问题出在 GitHub for Windows。我使用的是 GitHub for Windows 提供的 posh~git shell,这两件事之一已经为我的环境设置了全局配置。

在回到 GitHub 获取 Windows 自己的文档后,我发现了这个:

GitHub for Windows 不支持多个 Git 远程,它只能与源远程一起使用。

我认为这解释了它:(

于 2013-06-16T05:41:16.923 回答
2

这对我来说很好。不知何故,您有一个空白的上游遥控器。

在 git 目录中运行:

git remote rm upstream

然后再次添加上游:

git remote add upstream https://github.com/vanpop/CPT-Descriptions.git
于 2013-06-16T04:31:36.007 回答