git(2)======== 连接仓库后提交报错

在共享完成密钥后出现如下情况

[root@python3_ansible python]# git push -u origin master
Username for 'https://github.com': zcmdxj
Password for 'https://zcmdxj@github.com': 
error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/zcmdxj/python.git'
View Code

只是由于本地仓库为空导致的,在当前目录下写一个readme.md 的文件,提交文件的时候出现如下情况

[root@python3_ansible python]# git add readme.md 
[root@python3_ansible python]# git commit -m "init files"

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"           #将这两句话输入然后重新提交就可以了
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.


fatal: unable to auto
-detect email address (got 'root@python3_ansible.(none)')
[root@python3_ansible python]# git config --global user.email "mail66999@163.com"
[root@python3_ansible python]# git config --global user.name "zcmdxj"
[root@python3_ansible python]# git commit -m "init files"
[master (root-commit) 68e62fd] init files
 1 file changed, 1 insertion(+)
 create mode 100644 readme.md
[root@python3_ansible python]# git push -u origin master
Username for 'https://github.com': zcmdxj
Password for 'https://zcmdxj@github.com': 
To https://github.com/zcmdxj/python.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/zcmdxj/python.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.
[root@python3_ansible python]# git pull --rebase origin master
warning: no common commits
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 9 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (9/9), done.
From https://github.com/zcmdxj/python
 * branch            master     -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: init files
[root@python3_ansible python]# git push -u origin master
Username for 'https://github.com': zcmdxj
Password for 'https://zcmdxj@github.com': 
Counting objects: 4, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 318 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/zcmdxj/python.git
   f649646..97877a0  master -> master
Branch master set up to track remote branch master from origin.
[root@python3_ansible python]# 
View Code

 

转载于:https://www.cnblogs.com/zcmdxj/p/8325153.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值