远程推送到github可能遇到的问题

一: 执行命令:git remote add origin git@github.com:myGithub/myRepository.git

可能遇到:

     fatal: remote origin already exists(提示这个仓库已经存在)

    解决方法:如果是这样 就不需要使用add + 地址的形式了 ,请修改为: git remote rm origin

 

二:执行命令:git push -u origin master

    可能遇到问题:

    error:src refspec master does not match any

    原因分析:

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

    解决方法:

             在要提交的目录下,初始化并添加到要提交的文件中,即执行如下命令

$ git init
$ git add .
$ git commit -m 'initial commit'
$ git remote add origin git@gitserver:/opt/git/project.git
$ git push origin master

三:无法提交测试类到github

    原因分析:

            测试类文件没有添加到要提交的内容中去

    解决方法:

            执行上面问题二中的命令。

参考:

http://www.open-open.com/lib/view/open1366080269265.html

转载于:https://my.oschina.net/treeHeartPig/blog/807641

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值