Cannot update paths and switch to branch at the same time.

fatal: Cannot update paths and switch to branch 'master' at the same time.

Did you intend to checkout 'origin/master' which can not be resolved as commit?

如果是本地新创建的git仓库,并在首次提交时出现此类问题。

先执行:

--shell-*git fetch
git pull origin master

再执行

git push

clone一个git仓库,并做首次push,一般有如下步骤:

Step 1: 切到本地仓库上

cd /path/to/your/repo


Step 2: 连接到远程仓库

git remote add origin git@bitbucket.org:yonghuixie/r.git

git push -u origin master
git