github上传时出现error: src refspec master does not match any解决办法

这个问题,我之前也遇到过,这次又遇到了只是时间间隔比较长了,为了防止以后再遇到类似问题,还是把这个方法简单记录在此。

当然,是通过搜索引擎找到的答案,开始用谷歌,我以为stackoverflow会很权威的,结果在这上面没有找到合适的。

http://stackoverflow.com/questions/21264738/error-src-refspec-master-does-not-match-any
反倒是换用百度输入,查看中文的东西才解决了这个问题。

问题产生

原因分析

引起该错误的原因是,目录中没有文件,空目录是不能提交上去的

解决方法

touch README
git add README
git commit -m 'first commit'
git push origin master

来自:http://www.open-open.com/lib/view/open1366080269265.html
实际上

 git init

这一步之后创建了一个名为.git的文件夹,不过它在默认状态下是隐藏的,系统将隐藏文件夹显示出来,可以看到有这样一个文件夹。
github上传项目方法:
http://www.oschina.net/question/159132_86728
在你的电脑上装好git

大致流程是:

1、在github上创建项目

2、使用git clone https://github.com/xxxxxxx/xxxxx.git克隆到本地

3、编辑项目

4、git add . (将改动添加到暂存区)

5、git commit -m "提交说明"

6、git push origin master 将本地更改推送到远程master分支。

这样你就完成了向远程仓库的推送。

如果在github的remote上已经有了文件,会出现错误。此时应当先pull一下,即:

git pull origin master

然后再进行:

git push origin master

github上传时出现error: src refspec master does not match any解决办法的更多相关文章

  1. github上传时出现error: src refspec master does not match any解决办法22

    1 error:src refspec master does not match any这个问题,我之前也遇到过,这次又遇到了只是时间间隔比较长了,为了防止以后再遇到类似问题,还是把这个方法简单记录 ...

  2. 解决:github上传时出现error: src refspec master does not match any

    原因分析 引起该错误的原因是,目录中没有文件,空目录是不能提交上去的 解决方法 touch README git add README git commit -m 'first commit' git ...

  3. 【github问题】error: src refspec master does not match any解决方法|please tell me who you are

    http://www.open-open.com/lib/view/open1366080269265.html这个先记录一下省得以后再找 我这里要解决的问题根本是:please tell me wh ...

  4. git push 时发生错误 error: src refspec master does not match any. error: failed to push some refs to

    很多相关解决办法都是最后要 push 到远端的 master 上,但很多其实要求不能把个人的修改内容直接 push 到 master 主分支. 因此,当我想将本地 feature/work1 分支的修 ...

  5. git push 失败出现error: src refspec master does not match any.解决方案

    今天写好一个demo往GitHub上传时报错 错误提示: error: src refspec master does not match any. error: failed to push som ...

  6. GIT问题,error:src refspec master does not match any

    将本地GIT版本库PUSH到一个GITHUB上一个空的版本库时可能会出现如下错误error:src refspec master does not match any原因: 本地版本库为空, 空目录不 ...

  7. Git提交出现error: src refspec master does not match any的问题

    在本地与远程分别新建了一个仓库并且关联后,想要把本地的文件提交到github上面, 输入下方命令后没有成功,而是出现了报错:error: src refspec master does not mat ...

  8. error: src refspec master does not match any. 错误处理办法

    自从上次学了git之后,很少用.今天在使用 本地仓库使用如下命令初始化: $ git init 之后使用如下命令添加远程库: $ git remote add origin git@github.co ...

  9. Git:错误:error:src refspec master does not match any

    新建立了一个远程仓库,想着把项目放上去.于是在项目目录上: git init 然后就添加远程库 git remote add origin xxxx.git 然后就想push: git push -u ...

随机推荐

  1. IDM使用入门

    IDM使用入门 Software IDM介绍 基本使用 浏览器集成 选项设置 进阶使用 IDM+百度云外链 IDM介绍 Internet Download Manager(IDM) is a tool ...

  2. Python Web-第四周-Programs that Surf the Web(Using Python to Access Web Data)

    1.Understanding HTML 1.最简单的爬虫 import urllib fhand=urllib.urlopen('http://www.dr-chuck.com/page1.htm' ...

  3. 【Luogu3457】POW-The Flood(并查集)

    [Luogu3457]POW-The Flood(并查集) 题面 洛谷 题解 我们知道,如果一个点和一个海拔不高于它的点相连 那么连在那个点是更优的,所以考虑按照每个点的海拔排序 既然按照海拔排序,相 ...

  4. 【CJOJ2498】【DP合集】最长上升子序列 LIS

    题面 Description 给出一个 1 ∼ n (n ≤ 10^5) 的排列 P 求其最长上升子序列长度 Input 第一行一个正整数n,表示序列中整数个数: 第二行是空格隔开的n个整数组成的序列 ...

  5. HNOI2008玩具装箱

    斜率优化 # include <stdio.h> # include <stdlib.h> # include <iostream> # include <s ...

  6. Delphi的RzDbgrid改变某行的背景色

    本想改变符合条件的行的背景色,试了DbgridEh和原生的Dbgrid直接在DrawColumnCell事件中写重绘代码就好了,But在RzDbgrid就不起效果,查了好一会,百度了一大堆,都是千篇一 ...

  7. SpringMVC【开发Controller】详解

    前言 本文主要是讲解在Controller中的开发,主要的知识点有如下: 编码过滤器 使用注解开发 注解@RequestMapping详解 业务方法接收参数 字符串转日期 重定向和转发 返回JSON ...

  8. java 向上转型与向下转型

    转型是在继承的基础上而言的,继承是面向对象语言中,代码复用的一种机制,通过继承,子类可以复用父类的功能,如果父类不能满足当前子类的需求,则子类可以重写父类中的方法来加以扩展. 向上转型:子类引用的对象 ...

  9. C#多线程编程(7)--锁

    一提到线程同步,就会提到锁,作为线程同步的手段之一,锁总是饱受质疑.一方面锁的使用很简单,只要在代码不想被重入的地方(多个线程同时执行的地方)加上锁,就可以保证无论何时,该段代码最多有一个线程在执行: ...

  10. 设计模式——状态模式(C++实现)

    /////////context.cpp #include "context.h" void STContext::ChangeState(STState* pstState) { ...