25

I'm trying to update my webbynode pulling from github but I got the message below:

You asked to pull from the remote 'git@github.com:sigbackup/gsapp.git', but did not specify a branch. Because this is not the default configured remote for your current branch, you must specify a branch on the command line.

So I have checked out this forum for help and I found some comments regarding .git/config file but mine looks already fine (at least to me):

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = git@github.com:sigbackup/gsapp.git
[branch "master"]
        remote = origin
        merge = refs/heads/master
[branch "origin"]
        remote = origin
        merge = refs/heads/master

Am I missing something? Any ideas how I can solve it?

PS I also tried git pull origin git@github.com:sigbackup/gsapp.git and I got

fatal: Couldn't find remote ref git@github.com

ulidtko
  • 14,740
  • 10
  • 56
  • 88
Sig
  • 5,476
  • 10
  • 49
  • 89
  • what command did you run the first time? – Jacobo de Vera Feb 09 '11 at 10:52
  • I have a similar question at [specify-default-branch-for-a-non-default-remote-for-pull-rebase](http://stackoverflow.com/questions/7456709/specify-default-branch-for-a-non-default-remote-for-pull-rebase), but we want to do this without changing the default remote or explicitly listing the branch. – studgeek Sep 17 '11 at 17:50

2 Answers2

25

What local branch have you checked out?

What git status shows?

You are probably working on some other branch than the local master branch. If you want to fetch new commits from github and merge them to the local master branch, you have to:

git checkout master
git pull

If you want those commits in the branch, on which you are working, you need:

git pull origin master

You were close in your try from PS, but the last param should be branch name, not the repo url.


You can also just fetch new commits from github, and do not merge it into any local branch, with:

git fetch origin

Then review those changes with git diff, git log, etc, and merge later to the currently checked out branch with:

git merge origin/master
user2066657
  • 444
  • 1
  • 4
  • 23
silk
  • 2,714
  • 22
  • 21
  • 1
    Thanks for your reply. git checkout master git pull origin master solved my issue. – Sig Feb 09 '11 at 11:51
  • The branch names were different for me, but git merge / from within my forked repo worked. In the context of the original question is a remote that points to the old "working repo" directly on the local hard drive that has the changes one wants to replay. – Chris Chiasson Mar 07 '18 at 19:25
6

It's strange that you have a branch called origin. origin is used to name a remote automatically created during git clone; you will get in troubles having to disambiguate origin-the-branch and origin-the-remote. Did you add the branch manually to the .git/config? What commands did you run? I suspect that you messed this up.

ulidtko
  • 14,740
  • 10
  • 56
  • 88