mrwweb
mrwweb

Reputation: 1424

Can't set origin on github repo

I'm a newish git and GitHub user. I've been using GitHub for windows for a while but wanted to try more of the command line while learning how to fork and submit pull requests on a repo I want to improve.

What I'm seeing is that 'upstream' seems to be defined by unusable and I want to understand what's going on. I imagine that this will be a problem for when I want to request that my changes get pulled into the upstream repository.


I forked the repository on GitHub and then cloned it to my computer:

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

I then entered the new repository and tried to add the upstream as listed on the Forking Tutorial:

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

That gives me the error:

fatal: remote upstream already exists.

When I try: git fetch upstream, I get this:

fatal: 'upstream' does not appear to be a git repository

fatal: could not read remote repository.

Please make sure you have the correct access rights and the repository exists.

I've read other threads that suggest editing my git config file but there's no mention of upstream in it:

[core]

repositoryformatversion = 0

filemode = false

bare = false

logallrefupdates = true

symlinks = false

ignorecase = true

hideDotFiles = dotGitOnly

[remote "origin"]

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

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

[branch "master"]

remote = origin

merge = refs/heads/master

Finally, when I try git remote -v I get this:

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

origin https://github.com/mrwweb/CPT-Descriptions.git (push)

upstream

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

UPDATE: Adding the results of 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

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

files/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" mergetool.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 [email protected] 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=origin branch.master.merge=refs/heads/master

Upvotes: 2

Views: 3848

Answers (2)

mrwweb
mrwweb

Reputation: 1424

After a lot of trouble-shooting (thank you @alex_sf) I believe the problem is GitHub for Windows. I was using the posh~git shell provided with GitHub for Windows, and one of those two things had set up the global config for my environment.

After going back to GitHub for Windows' own documentation, I found this:

GitHub for Windows does not support multiple Git remotes and it will only work with the origin remote.

I think that explains it :(

Upvotes: 3

alexphilipp
alexphilipp

Reputation: 215

This works fine for me. Somehow you have a blank upstream remote.

Run this in the git directory:

git remote rm upstream

Then add the upstream again:

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

Upvotes: 2

Related Questions