自从上次学了git之后,很少用。今天在使用

本地仓库使用如下命令初始化:

$ git init

之后使用如下命令添加远程库:

$ git remote add origin git@github.com:hahah/ftpmanage.git

然后使用

$ git push -u origin master

出现如下错误:

error: src refspec master does not match any.
error: failed to push some refs to 'git@github.com:hahaha/ftpmanage.git'

原因:

本地仓库为空

解决方法:使用如下命令 添加文件;

$ git add add.php addok.php conn.php del.php edit.php editok.php ftpsql.sql index.php

$ git commit -m "init files"

之后在push过程中出现如下错误:

$ git push -u origin master
Warning: Permanently added the RSA host key for IP address 'xx.xx.xxx.xxx' to the list of known hosts.
To git@github.com:hahaha/ftpmanage.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:hahahah/ftpmanage.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 integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

提示使用 git pull 之后在 push

使用如下命令解决:

$ git pull --rebase origin master
warning: no common commits
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From github.com:hahah/ftpmanage
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
First, rewinding head to replay your work on top of it...
Applying: init files

继续push,成功。

$ git push -u origin master
Counting objects: , done.
Delta compression using up to threads.
Compressing objects: % (/), done.
Writing objects: % (/), 5.15 KiB | bytes/s, done.
Total (delta ), reused (delta )
To git@github.com:hahaha/ftpmanage.git
a2b5c30..1044f15 master -> master
Branch master set up to track remote branch master from origin.

大功告成!!!

error: src refspec master does not match any. 错误处理办法的更多相关文章

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

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

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

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

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

    github上传时出现error: src refspec master does not match any解决办法 这个问题,我之前也遇到过,这次又遇到了只是时间间隔比较长了,为了防止以后再遇到类 ...

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

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

  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. error: src refspec master does not match any.

    执行下面的命令,git push 时候出错: git push origin master 出现如下错误: 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. git push 时发生错误 error: src refspec master does not match any. error: failed to push some refs to

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

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

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

随机推荐

  1. Dev ChartControl鼠标移动显示坐标点

    his.chartIRC_RATES.MouseMove += new MouseEventHandler(chartIRC_RATES_MouseMove); ToolTipController t ...

  2. 父进程等待子进程结束 waitpid wait

    我们一直在强调一个概念就是进程是一个程序执行的实例,是内核在虚拟概念下创建的实体,它实例化的体现在用户态就是程序代码和代码使用的变量(存储空间),在内核态就是内核为我们每个进程所保存的数据结构(状态信 ...

  3. jquery 使用方法(一)

    jquery是什麼? jquery,顾名思义,也就是JavaScript和查询(Query),即是辅助JavaScript开发的函數库. javascript是屬於網絡的腳本語言,宿主文件是html, ...

  4. C# windows form如何隐藏窗口?

    you can use this line of code. It wont hide it, but it will be minimized: this.WindowState = FormWin ...

  5. WCF之Binding详解

    本文的出发点: 通过阅读本文,您能了解以下知识: WCF中的Binding是什么? Binding的组 成? Binding Element 的分类? Binding描述 了那些层面的信息? 选择正确 ...

  6. Angular JS中双击事件ng-dblclick避免同时触发两次单击事件ng-click的解决方案

    有些需求中,需要一个元素上既有双击事件,也有单击事件,而两者实现的效果不一样. 这时可以使用ng-dblclick与ng-click来实现需求,但是要避免浏览器将双击事件误认为是两次单击事件,从而出现 ...

  7. MongoDB-JAVA-Driver 3.2版本常用代码全整理(4) - 地理空间索引

    MongoDB的3.x版本Java驱动相对2.x做了全新的设计,类库和使用方法上有很大区别.例如用Document替换BasicDBObject.通过Builders类构建Bson替代直接输入$命令等 ...

  8. inotifywait命令

    [命令格式]: inotifywait [ options ] file1 [ file2 ] [ file3 ] [ ... ][命令原意]: inote file system wait[命令路径 ...

  9. AIDL和生成的java文件要分开存放,否则生成can't find symbol class

    Android 5.0之后需要AIDL和生成的java文件要分开存放,否则生成can't fin symbol class.但是4.3没有这个限制.被这个弄了一天,跟老大讨论了一下才豁然开朗.

  10. flash开发几个问题

    1.跨域请求xml或txt 问题,使用URLLoader,不能跨域使用 2.js和swf交互问题,尽量使用swfobject.js动态创建