国庆归来准备试用一下git,在提交代码时遇到时遇到一些问题

提交时使用git push origin master

出现failed to push some refs to git

回想一下,创建该项目时显示尝试使用了git for win的客户端离线版,发现不能上传,又在github上重新创建仓库,建立README.md,导致该文件不在本地代码中

可以通过以下方式解决

git pull --rebase origin master

执行后可以看到本地代码中多了README.md文件

再次执行git push origin master即可完成代码上传

下面记录一下上传github仓库主分支一般步骤

1)先在github网页建立一个新的仓库,勾选Initialize this repository with a README

2)在要传的文件夹右击git inti here(我用的是的git bash)

3)若没有执行第二步,那么cd到所传文件夹中执行 git init (第二步已经执行该步忽略)

4)git remote add origin 后面复制粘贴github上新建仓库的地址(复制粘贴即可),如下图

如果(出现origin exitss  输入git  remote  rm  origin,再次执行上面那条语句)

5)git pull origin master

6)  git add 文件  (git add -A 为添加该文件夹所有文件)

7) git commit -m "注释"(添加注释 可选)

8)git push origin master

ok!

git中failed to push some refs to git问题解决及基本使用的更多相关文章

  1. git error: failed to push some refs to 'git@github.com:xxx/xxx.git'

    本地仓库中和远程仓库不一致,缺少readme.md文件 解决方式参见:https://blog.csdn.net/qq_37281252/article/details/79044798

  2. 由于github仓库中提前建立readme文件,导致git push报错error: failed to push some refs to 'git@github.com:

    $ git push -u origin master To git@github.com:xxx/xxx.git ! [rejected] master -> master (fetch fi ...

  3. 解决failed to push some refs to git

    Administrator@PC-20150110FGWU /K/cocos2d/yc (master) $ git push -u origin master To git@github.com:y ...

  4. 如何解决failed to push some refs to git

    $ git push -u origin master To git@github.com:yangchao0718/cocos2d.git ! [rejected]        master -& ...

  5. git push报错error: failed to push some refs to 'git@github.com'

    git push报错error: failed to push some refs to 'git@github.com' $ git push -u origin master To git@git ...

  6. [转载]如何解决failed to push some refs to git

    Administrator@PC-20150110FGWU /K/cocos2d/yc (master) $ git push -u origin master To git@github.com:y ...

  7. failed to push some refs to 'git@github.com:xxx/xxx.git' 解决方法

    此时很多人会尝试下面的命令把当前分支代码上传到master分支上. $ git push -u origin master 但依然没能解决问题 会出现: failed to push some ref ...

  8. Git错误:error:failed to push some refs to 'git@gitee.com:name/project.git'

    大家在通过本地仓库上传文件到远程仓库时,会报出 error:failed to push some refs to 'git@gitee.com:name/project.git' 的错误. 解决方法 ...

  9. Git 应用问题(一) —— failed to push some refs to git

    今天在本地创建了一个新的 repository,想关联到 Github 上的时候出现问题,如下: Gerrard@LAPTOP-79570TK2 MINGW64 /g/github-workspace ...

随机推荐

  1. Do a web framework ourselves

    step 1: from wsgiref.simple_server import make_server def application(environ, start_response): star ...

  2. MySQL命令行SQL脚本的导入导出小结(数据库的备份与还原)

    1.设置环境变量 要想在命令行下各处都能执行mysql命令,必须在系统变量Path中添加mysql的命令所在的目录.例如我安装的是集成PHP环境的mysql,在D盘xampps下,则我需要将" ...

  3. HOG OpenCV 代码片段

    直接上代码: #include <opencv2/opencv.hpp> using namespace cv; #include <cmath> using namespac ...

  4. 在Ubuntu12.04上安装图形化配置与window共享的samba服务器

    1.安装samba图形化配置界面 sudo apt-get install system-config-samba 2.启动图形化配置界面 3.添加用户,最好是要用adduser命令去添加 具体配置可 ...

  5. DoesNotExist at /admin/

    DoesNotExist at /admin/ User has no account. Request Method: GET Request URL: http://127.0.0.1:8000/ ...

  6. MySQL执行插入操作时报错1366 - Incorrect string value

    今天在测试mysql时,发现插入数据的问题,下面和大家分享下解决方法: 首先看问题原因: [Err] 1366 - Incorrect string value: '\xCF\xD6' for col ...

  7. Servlet - 基础

    Servlet 标签 : Java与Web HTTP协议 HTTP(hypertext transport protocol),即超文本传输协议.这个协议详细规定了浏览器(Browser)和万维网服务 ...

  8. activiti 任务节点 处理人设置

    1.1.1. 前言 分享牛原创(尊重原创 转载对的时候第一行请注明,转载出处来自分享牛http://blog.csdn.net/qq_30739519) 我们在使用activiti 工作流引擎的时候, ...

  9. Struts 2 标签库

    <s:if>标签 拥有一个test属性,其表达式的值用来决定标签里内容是否显示 <s:if test="#request.username=='clf'"> ...

  10. C语言实现简单黑客帝国代码流

    #include <stdio.h> #include <stdlib.h> #include <time.h> #include <windows.h> ...