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

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

git remote add upstream

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:


repositoryformatversion = 0

filemode = false

bare = false

logallrefupdates = true

symlinks = false

ignorecase = true

hideDotFiles = dotGitOnly

[remote “origin”]

url =

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 (fetch)

origin (push)



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


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 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.upstream.fetch=+refs/pull//head:refs/remotes/upstream/pr/ core.autocrlf=true

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

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




branch.master.remote=origin branch.master.merge=refs/heads/master

  • could not read Username for '': No such device or address
  • How do I clone/pull from GitHub, but push to Kiln?
  • How to get last commit date inside a folder/directory in github repo?
  • Git submodule not getting removed from git repo and not getting pushed successfully
  • How can I get faster SSH clone speeds on windows?
  • Unable to push commits from a git submodule?
  • permission denied (public key) error for ssh -vT
  • Merged a Pull request merged multiple branches at once
  • 2 Solutions collect form web for “Can't set origin on github repo”

    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

    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 I believe that one of those two things had the setup 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 🙁

    Git Baby is a git and github fan, let's start git clone.