

如何处理 git使用中push报错
source link: https://www.linuxprobe.com/git-push-error.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

间隔了一段时间未往gitlab上push文件,近期使用时,发现push时报错,这里记录下解决处理的方法。
[root@361way shell]# git push warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git)
放"狗"查询后,得知‘matching’ 参数是 Git 1.x 的默认行为,其意是如果你执行 git push 但没有指定分支,它将 push 所有你本地的分支到远程仓库中对应匹配的分支。而 Git 2.x 默认的是 simple,意味着执行 git push 没有指定分支时,只有当前分支会被 push 到你使用 git pull 获取的代码。键入如下命令:
[root@361way shell]# git config --global push.default matching
[root@361way shell]# git push -u origin master To https://361way:[email protected]/361way/shell.git ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://361way:[email protected]/361way/shell.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first merge the remote changes (e.g., hint: 'git pull') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
再次push,发现又有报错,根据报错内容,大致了解的情况是,本地和远端的内容可能不一致,建议git pull 一份,再push到romte 。由于平时有些修改会在阿里云服务器上修改过的懒得push到远端同步,所以本地和远端的不一致也是有可能的。即然不一致,以阿里云上保存的为准吧,强制同步下。
[root@361way shell]# git push -u origin master --force
强制同步,发现可以正常同步内容到github上,而且后面再加文件进行同步,发现也未出现报错了。
Recommend
-
57
在启动VMware虚拟机的时候遇见的报错,在一路的报错上不停地折腾,最终总结自己的失败经验,也写下成功的办法,这样就能帮助更多人了。越折腾,越幸运。
-
70
-
14
问题一:[root@cdeba90ec46e~]#./configure--prefix=/usr/local/nginx--user=www--group=www--with-http_stub_status_modulebash:./configure:Nosuchfileordirectory//解决思路:表示在执行预编译./configure没有找到configure执行文件,改文件不存在
-
6
如何设置git push和git pull的超时时间? 不知道为什么,最近从 github 上git push 和 git pull 的时候总是不太稳定,有时候 pull 了半天都拉不下来,然后中断后重试一次又很顺畅了。 所以我想主动设置git push 和 git pull 的超时时间,这...
-
13
ELK-学习笔记–filebeat报错too many open files处理 |坐而言不如起而行! 二丫讲梵 > 迎刃而解 > <十七>ELK-学习笔记–filebeat报错too many open files处理
-
14
macOS 下 MongoDB 连接报错排查过程及处理0 Comments在 macOS 下使用 Homebrew 安装 MongoDB。但在 Homebrew 的核心库中...
-
10
使用 git push –mirror 迁移 Git 项目 2021-07-19 从 Gogs 切换到 Gitea 迁移了不少仓库,记录下命令。使用 git bare 的方式拉下来旧仓库的代码,bare 能拉下来所有项目信息包括分支,TAG。git clone...
-
7
安装swoole扩展步骤如下: # 1,下载包。 $ wget https://pecl.php.net/get/swoole-4.3.6.tgz
-
11
拖到再不解决就要弃博的状态,都有网络有关! Personal Access Token 错误 大半年前每次 push 更新都会收到 GitHub 邮件,提示什么什么到期,但不影响提交。直到前几天跳出: remote: Password authenticatio...
-
24
解决 git push:pack exceeds maximum allowed size 报错的问题前天github上有个仓库被dmca封掉了,不得不提工单申请解封处理一波 → Github仓库由于DMCA被封怎么办? 不过由于...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK