git上有develop分支,branch查看分支看不到develop,checkout切换分支报错
一、问题
git上有develop分支,branch查看分支看不到develop,checkout切换分支报错
(一)branch查看分支
git branch -a
结果:看不到develop分支。
(二)checkout切换分支
git checkout develop
结果:报错error: pathspec 'develop' did not match any file(s) known to git.
二、解决方案
先fetch更新分支再checkout切换分支(由于远程分支是新建的,本地没有更新)
(二)fetch更新远程分支
git fetch
(二)checkout切换分支-
git checkout develop
root@ubuntu:/home/ubuntu/linux-tsn# git branch --all * dev remotes/origin/dev root@ubuntu:/home/ubuntu/linux-tsn# git checkout dev2.0 error: pathspec 'dev2.0' did not match any file(s) known to git. root@ubuntu:/home/ubuntu/linux-tsn# git fetch [email protected]: Permission denied (publickey,gssapi-keyex,gssapi-with-mic). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. root@ubuntu:/home/ubuntu/linux-tsn# ssh-add ~/Ssh.pub ~/Ssh.pub: No such file or directory root@ubuntu:/home/ubuntu/linux-tsn# ssh-add .~/Ssh.pub Error loading key ".~/Ssh.pub": invalid format root@ubuntu:/home/ubuntu/linux-tsn# ssh-add .~/Ssh Identity added: .~/Ssh (.~/Ssh) root@ubuntu:/home/ubuntu/linux-tsn# git fetch remote: Counting objects: 108491, done. remote: Compressing objects: 100% (93832/93832), done. Receiving objects: 95% (103480/108477), 975.51 MiB | 31.39 MiB/s