1.软文推荐

2.软文推荐

3.软文推荐

git 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:mypassword@github.com/361way/shell.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://361way:mypassword@github.com/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上,而且后面再加文件进行同步,发现也未出现报错了。

本文来源:www.lxlinux.net/7376.html,若引用不当,请联系修改。

相关文章 8

1

nginx缓存静态页面(nginx 设置页面缓存) 3分钟前

目录:1、Nginx缓存设置教程2、nginx如何配置静态页面3、nginx缓存(proxy_cache模块)4、nginx 反代里缓存怎么清理5、【NGINX入门】3.Nginx的缓存服务...

2

通过5个问题彻底掌握IP地址的计算 5分钟前

IP地址是一个32位的二进制数,它由网络ID和主机ID两部份组成,用来在网络中唯一的标识的一台计算机,在计算机考研系列中计网的IP地址计...

3

有了这款 Linux 网络延迟排查方法,再也不用加班了 7分钟前

在我的上一篇文章中,我向您展示了如何模拟 DDoS 攻击以及如何缓解它。简单回顾一下,DDoS 利用了大量的伪造请求,导致目标服务器消耗大...

4

centos查看cpu占用率(centos 查看cpu占用) 9分钟前

目录:1、linux系统怎么查看cpu使用情况2、怎么查看linux的cpu,内存等占用率3、centos系统命令使用-top4、如何查看centos系统cpu/内存使用情况...

5

在 Ubuntu 16.04 Server 上安装 Zabbix 11分钟前

zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的方案,其目的是监视各种网络参数,保证服务器系统的安全运营。 安装...

6

Linux下VNC Server的安装配置 12分钟前

VNC是 虚拟网络 控制台的缩写。它 是一款优秀的 远程控制 工具软件,VNC 是在基于 UNIX 和 Linux 操作系统的免费的 开源软件 ,远程控制能力...

7

大硬盘云主机(硬盘 主机) 14分钟前

目录:1、云主机和服务器的区别2、云主机是什么意思?求教下3、云主机如何挂载硬盘?4、目前来看云主机哪家好用5、国内云主机:2核、...

8

Linux系统安装ZooKeeper具体步骤 17分钟前

Linux系统如何安装ZooKeeper ?ZooKeeper是一个针对大型分布式系统的可靠协调系统,提供的功能包括:配置维护、名字服务、分布式同步、组服...