当我运行“git remote show guarddog”时,我希望看到类似这样的内容:
Local ref configured for 'git push':
guarddoglocal pushes to master
然而,这实际上就是我所看到的:
git remote show guarddog
Username for 'github.com':
Password for 'github.com':
* remote guarddog
Fetch URL: https://github.com/guarddog/guarddog.git
Push URL: https://github.com/guarddog/guarddog.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
guarddoglocal merges with remote master
显然,没有为git push配置guarddoglocal到guarddog / master。
这是我到目前为止所做的:
git remote -v
origin https://github.com/usera/usera.git (fetch)
origin https://github.com/usera/usera.git (push)
git remote add guarddog https://github.com/guarddog/guarddog.git
git remote -v
guarddog https://github.com/guarddog/guarddog.git (fetch)
guarddog https://github.com/guarddog/guarddog.git (push)
origin https://github.com/usera/usera.git (fetch)
origin https://github.com/usera/usera.git (push)
git status
# On branch useralocal
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: app/assets/javascripts/application.js.erb
git push guarddog useralocal:master
git checkout -b guarddoglocal guarddog/master
git branch
* guarddoglocal
useralocal
git status
# On branch guarddoglocal
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: app/assets/javascripts/application.js.erb
git remote show guarddog
Username for 'github.com':
Password for 'github.com':
* remote guarddog
Fetch URL: https://github.com/guarddog/guarddog.git
Push URL: https://github.com/guarddog/guarddog.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
guarddoglocal merges with remote master
正如您所看到的,拉动看起来合理,但默认推动没有。当我推动分支guarddoglocal时,我需要确保它推送到guarddog远程存储库。
尝试这样的事情不会改变任何事情:
git push -u guarddoglocal guarddog:master
答案 0 :(得分:0)
我认为您错误地使用了-u
选项
git push -u guarddog guarddoglocal:master
^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^
remote name local branch remote branch
在guarddoglocal
分支中,将其配置为跟踪master
遥控器上的guarddog
分支。