git报错There is no tracking information for the current branch

今天在github新建git仓库,并且push的时候,报了这个错

同理  git pull命令也会报错这个错误

造成的原因很简单,也就是说  在push/pull的时候要告诉git 是push/pull那个分支,也就是建立本地分支与远程分支的关系

查看本地分支与远程分支的关系   git  branch -vv

解决办法:    把本地与远程建立关联

git branch  --set-upstream-to=origin/master master 

git branch --set-upstream-to=origin/远程分支的名字  本地分支的名字

之后问题就解决了

猜你喜欢

转载自blog.csdn.net/qq_38526952/article/details/89553589