我看不到我的远程分支 [英] I can't see my remote branch
本文介绍了我看不到我的远程分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
git branch -r
不会返回任何内容。这里发生了什么? $ git init
#做了一些命令
git config remote.origin.url ssh:// gerrit.mm-sol.com/branchname
$ git push origin SH1-my-last-commit:master
错误:无法推送到不合格目的地:master
目标refspec既不匹配遥控器上现有的ref,
也以refs /开头,我们无法根据源参考猜测前缀。
错误:未能将一些文件推送到'ssh://gerrit.mm-sol.com/apps/phone-shaker'
$ git push origin master
计数对象:85,完成。
使用多达4个线程的增量压缩。
压缩对象:100%(85/85),完成。
写作对象:100%(85/85),20.95 KiB,完成。
共计85(增量49),重用0(增量0)
远程:解决变化:100%(49/49)
远程:更新引用:100%(1/1)
到ssh://gerrit.mm-sol.com/branchname
* [新分支] master - > master
解决方案
试试这个:
git config remote.origin.fetch+ refs / heads / *:refs / remotes / origin / *
git fetch origin
,然后再次尝试 git branch -r
p>
在将来设置远程时,最好使用下面的命令而不是 git config
:
git remote add< remotename> < remoteurl>
例如
git remote add origin ssh://gerrit.mm-sol.com/branchname
这会自动设置 url
和 fetch
配置。
While waiting for the sysadmin to set up the gerrit repo, I made my own branch. He just now sent me the address of the repo. I set it for origin and somehow pushed my last commit. Cloning the repo works fine, however git branch -r
returns nothing. What is going on here?
$ git init
# made some comits
git config remote.origin.url ssh://gerrit.mm-sol.com/branchname
$ git push origin SH1-of-my-last-commit:master
error: unable to push to unqualified destination: master
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to 'ssh://gerrit.mm-sol.com/apps/phone-shaker'
$ git push origin master
Counting objects: 85, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (85/85), done.
Writing objects: 100% (85/85), 20.95 KiB, done.
Total 85 (delta 49), reused 0 (delta 0)
remote: Resolving deltas: 100% (49/49)
remote: Updating references: 100% (1/1)
To ssh://gerrit.mm-sol.com/branchname
* [new branch] master -> master
解决方案
Try this:
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin
and then try git branch -r
again.
In the future when setting up remotes, it's preferable to use the following command instead of git config
:
git remote add <remotename> <remoteurl>
e.g.
git remote add origin ssh://gerrit.mm-sol.com/branchname
This will automatically set up both the url
and fetch
configuration.
这篇关于我看不到我的远程分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文