Home > Net >  Git checkout fail
Git checkout fail

Time:11-13

I have a project I want to bring into Git.
I have my local git config complete, verified I can SSH in, and have a branch "main" setup on GitHub.
I substituted "xyz" for my actual GitHub branch.

The "git checkout" command does not appear to be creating a local branch, and no error message is issued.

git remote -v

svi     [email protected]:rboudrie/XYZ.git (fetch)
svi     [email protected]:rboudrie/XYZ.git (push)

git branch -a

remotes/xyz/main

git checkout -b newbranch

Switched to a new branch 'newbranch'

git branch -a

remotes/xyz/main

I am attempting to create a local branch, and am expecting the branch to show up in "git branch -a" (or just git branch) when done.
I used the "-a" on git branch to prove I am successfully connecting to my repo on github.com.

CodePudding user response:

it appears that you are only handling remote branches... when you run the first "git branch -a" the local main branch should have appeared before the remote one... weird.

try seeing current branch with git branch --show-current

CodePudding user response:

First, do not use the obsolete git checkout command, but rather git switch.

Second, when you clone your repository, your remote should be named by default "origin", not "svi"

Try and clone again, to confirm this would work:

git clone [email protected]:rboudrie/XYZ.git
cd XYZ
git remote -v
git switch -c newBranch
git branch -avv
  • Related