git======== 连接仓库后提交报错

Posted 小雪

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git======== 连接仓库后提交报错相关的知识,希望对你有一定的参考价值。

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

技术分享图片
[[email protected]_ansible python]# git push -u origin master
Username for https://github.com: zcmdxj
Password for https://[email protected]: 
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 的文件,提交文件的时候出现如下情况

[[email protected]_ansible python]# git add readme.md 
[[email protected]_ansible python]# git commit -m "init files"

*** Please tell me who you are.

Run

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

to set your accounts default identity.
Omit --global to set the identity only in this repository.


fatal: unable to auto
-detect email address (got [email protected]_ansible.(none))
技术分享图片
[[email protected]_ansible python]# git config --global user.email "[email protected]"
[[email protected]_ansible python]# git config --global user.name "zcmdxj"
[[email protected]_ansible python]# git commit -m "init files"
[master (root-commit) 68e62fd] init files
 1 file changed, 1 insertion(+)
 create mode 100644 readme.md
[[email protected]_ansible python]# git push -u origin master
Username for https://github.com: zcmdxj
Password for https://[email protected]: 
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.
[[email protected]_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
[[email protected]_ansible python]# git push -u origin master
Username for https://github.com: zcmdxj
Password for https://[email protected]: 
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.
[[email protected]_ansible python]# 
View Code

 


以上是关于git======== 连接仓库后提交报错的主要内容,如果未能解决你的问题,请参考以下文章

git连接不上远程仓库---visualstudio提交代码报错:no upstream configured for branch 'master'

git push 提交报错 403 ,处理方式

git创建远程仓库地址---上传代码

git提交代码到远程仓库github

windows提交代码到git仓库

配置git连接远程码云仓库,并且码云仓库代码部署到服务器