2

I am trying to checkout a branch from my forked repository but it gives an error:

Repository: https://github.com/tmsblgh/codechecker/tree/issue799

MacBook-Pro:codechecker tmsblgh$ git branch -vv * master acdc482 [origin/master] Merge pull request #1636 from gyorb/version68 MacBook-Pro:codechecker tmsblgh$ git --version git version 2.17.1 MacBook-Pro:codechecker tmsblgh$ git fetch MacBook-Pro:codechecker tmsblgh$ git checkout issue799 error: pathspec 'issue799' did not match any file(s) known to git. Baloghs-MacBook-Pro:codechecker tmsblgh$ git remote -v origin https://github.com/tmsblgh/codechecker.git (fetch) origin https://github.com/tmsblgh/codechecker.git (push) MacBook-Pro:codechecker tmsblgh$ git checkout issue799 error: pathspec 'issue799' did not match any file(s) known to git. 
4
  • Check your remote server by typing git remote -v, I am pretty much its pointing to repo you have forked your repo from. If it is, change it to your origin. Commented Jun 8, 2018 at 16:31
  • updated the question Commented Jun 8, 2018 at 16:39
  • Which version of Git are you using? Commented Jun 8, 2018 at 17:01
  • git version 2.17.1 Commented Jun 8, 2018 at 17:04

3 Answers 3

1

It seems the local repo doesn't have origin/issue799.

#fetch the branch git fetch origin issue799 #see if origin/issue799 exists git branch -a #if yes git checkout issue799 #if not, create the local branch from FETCH_HEAD git checkout -b issue799 FETCH_HEAD #the next push after you make some new commits git push -u origin issue799 
Sign up to request clarification or add additional context in comments.

Comments

1

This branch is perhaps not in your local git setup. Try git checkout origin/issue799

P.S.: origin is the remote you are pointing to

2 Comments

MacBook-Pro:codechecker tmsblgh$ git checkout origin/issue799 error: pathspec 'origin/issue799' did not match any file(s) known to git.
do git fetch to make sure you have everything in local setup. If it doesn't help, try cloning repo again
1

You can set up a local branch to track the remote:

git checkout -b issue799 origin/issue799 

EDIT (in response to comments):

I don't know why you are getting an error but here's what I did starting from scratch and it seems to work for me:

 $ git clone https://github.com/tmsblgh/codechecker.git Cloning into 'codechecker'... remote: Counting objects: 14825, done. remote: Total 14825 (delta 0), reused 0 (delta 0), pack-reused 14825 Receiving objects: 100% (14825/14825), 12.57 MiB | 22.70 MiB/s, done. Resolving deltas: 100% (10329/10329), done. $ cd codechecker/ /home/nick/tmp/codechecker $ git branch * master $ git remote -v origin https://github.com/tmsblgh/codechecker.git (fetch) origin https://github.com/tmsblgh/codechecker.git (push) $ git checkout -b issue799 origin/issue799 Branch issue799 set up to track remote branch iue799 from origin. Switched to a new branch 'issue799' 

3 Comments

MacBook-Pro:codechecker tmsblgh$ git checkout -b issue799 origin/issue799 fatal: 'origin/issue799' is not a commit and a branch 'issue799' cannot be created from it
What does git remote -v say?
MacBook-Pro:codechecker tmsblgh$ git remote -v origingithub.com/tmsblgh/CodeChecker.git (fetch) origingithub.com/tmsblgh/CodeChecker.git (push)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.