如何解决failed to push somegit refspec to git

如何解决failed to push some refs to git_百度知道
如何解决failed to push some refs to git
可以通过如下命令进行代码合并【注:pull=fetch+merge] git pull --rebase origin master
知道智能回答机器人
我是知道站内的人工智能,可高效智能地为您解答问题。很高兴为您服务。
其他类似问题
为您推荐:
git的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁最近工作中遇到这样的问题,使用的是Git做版本控制,在PUSH代码的时候,出现如下错误:
error: dst refspec XXX matches more than one.
error: failed to push some refs to 'git@xxx.xx:xxx.git'
初步一看,还想,怎么可能,出现两个相同的分支?表示很不解。
查看Git服务器上的分支也只有一个指定名称的分支,最后无意间发现在于服务器上有一个和分支名称相同的tag,安装项目组的习惯,tag一般都是以时间作为名称的,这里怎么会出现这个,好奇中删掉它重试,果然,Git把tag和分支搞在一起了,tag名称不能和分支名称完全相同,不知道这是Git个别版本的bug还是就这样机制。
仅此记录以方便大家。
文章标签:,,,,,
固定链接:
扫二维码:
版权所有:博客文章(除"转载分享"),未经注明,均为朴人博客原创、整理,未经允许,请勿转载。
Git push error:dst refspec XXX matches more than one
支付宝打赏--一步,二步,三步,N步,二行脚印
张映 发表于
分类目录:
标签:, , , ,
如果对git命令行不熟悉的话,用git图形界面工具,就比较合适了。建议使用tortoisegit这样的工具,命令行从学习到灵活掌握的时间成本比较高的。
# git clone git@192.168.10.202:develop/test.git
# touch test.txt
//测试文件
# git add test.txt
//git添加文件
# git commit -m 'test'
//添加到本地版本库
# git push
//push到远程
如果push报错,Perhaps you should specify a branch such as 'master'
解决办法:
# git push origin master
//只要这样操作一次,以后就可以用git push
添加文件和添加目录,操作是一样的。
2,修改文件
# echo "" & test.txt
# git add test.txt && git commit -m 'test2'
# git push
# echo "abc" & test.txt
# git commit -am "test3" //所有修改都会提交
# git push
如果有多个文件,只想提交其中的一个或者多个,怎么办呢
# git commit -a
//该命令出现以下内容
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
# (use "git reset HEAD &file&..." to unstage)
# modified: ab
# modified: test.txt //如果只想提交test.txt,只要把该行前的#去掉,保存退出就行了
# git push
//退出后,在执行push
# git rm ab
//如果删除目录的话,加上-r
# git commit -am "del"
# git push
4,解决冲突
# git push
//push不上去
Address 192.168.10.202 maps to unassigned.psychz.net, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
To git@192.168.10.202:develop/test.git
! [rejected] master -& master (non-fast-forward)
error: failed to push some refs to '192.168.10.202:develop/test.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.
# git pull //更新代码,提示冲突
Address 192.168.10.202 maps to unassigned.psychz.net, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From 192.168.10.202:develop/test
367dad3..5e5640b master -& origin/master
Auto-merging test.txt
CONFLICT (content): Merge conflict in test.txt
Au fix conflicts and then commit the result.
# vim test.txt
//修改冲突文件,并保存
# git commit -am "remove conflict"
//重新提交到本地版本库
# git push
//同步到远程
转载请注明作者:海底苍鹰地址:git服务器搭建_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
评价文档:
git服务器搭建
上传于||文档简介
&&c​e​n​t​o​s​系​统​下​简​单​g​i​t​服​务​器​搭​建
大小:6.59KB
登录百度文库,专享文档复制特权,财富值每天免费拿!
你可能喜欢

我要回帖

更多关于 git push rpc failed 的文章

 

随机推荐