Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8644203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:14:12+00:00 2026-06-12T12:14:12+00:00

I have cloned a repo using git. Another user created a new branch, call

  • 0

I have cloned a repo using git. Another user created a new branch, call it foo (there are so two branches master and foo). I created another branch foo to track remote foo. So I ran this command : git branch –set-upstream foo origin/foo. But I have an error message telling me : fatal: Not a valid object name: 'origin/foo' Can anybody help ? When I run git remote origin show I have the message :

* remote origin
  Fetch URL: ssh://***
  Push  URL: ssh://***
  HEAD branch: foo
  Remote branches:
    master   tracked
    foo new (next fetch will store in remotes/origin)
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (local out of date)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:14:13+00:00Added an answer on June 12, 2026 at 12:14 pm

    you must first fetch or pull the branch up to your local repo.

    git fetch origin
    # OR
    git pull origin
    

    After that, you can checkout foo

    git checkout foo
    

    And, you could use the above command you wrote to track origin/foo with another local branch name (put in your call, just checkout as you use the same name anyway).

    Git remote are only somewhere you can pull/push change. But in reality, all what git do is on your local drive, so you cannot interact with remote branch unless you fetch them first to your locale. origin/foo is only a label on a sha-1 commit id that you hold locally. When you use origin/foo, you reference the local label, not the remote status (there’s no ssh connection made while referencing a remote branch).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a bare git repo (lets call it repo #1) and cloned
I have cloned my svn repo using git, specifying branches and trunk (no tags
I have cloned a svn project repo using git-svn. When I fetch commits, how
I have a cloned git-svn repo. Using "git svn rebase" will get me latest
I have cloned a project from a git repo into eclipse Helios using the
I'm using the Thor gem, but I have cloned the git repo to a
I have started using Git. I have cloned the repo on my local system.
I have a remote git repository and I have cloned one branch git clone
I have two git repositories: report.git (Master on remote location) cloned.git (Local) I lost
I have a 3 year old svn repo I just converted to git using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.