重新跟踪远程文件
如下的命令,使用场景是,本地有原代码,但是没有与远程git做关联,或关联不正确,需要重新跟踪远程git
直接修改
git remote origin set-url URL
先删除再添加
删除
git remote rm origin
添加
git remote add origin https://xxx.git
git push -u origin yourbranch
-u参数能够建立关联
关联
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> modules
$ git branch --set-upstream-to=origin/modules modules
Branch modules set up to track remote branch modules from origin.