上传github文件及所出现的问题
上传github所发现的问题
准备工作
使用 git bush 输入下面的命令
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
上传代码到 GitHub 的步骤:
- 新建一个文件夹 ,放入需要上传的代码文件
- 使用 git 进入到该文件夹下
- 执行
git init - 执行
git add . - 执行
git commit -m "upload" - 执行
git remote add origin https://github.com/yourname/yourrepository.git - 执行
git push -u origin master
使用 git push -u origin master 出现的问题
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:zweros/DataStructure.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
然后按照网上的文章说 git pull origin master
使用 git pull origin master 发现的问题
*branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories
解决方案
You need to either `reset` or `commit` your changes first:
git reset --hard
or:
git commit -m "saving changes..."
Then you can do:
git pull origin master --allow-unrelated-histories
最后终于能上传成功了
$ git push -u origin master
Enumerating objects: 204, done.
Counting objects: 100% (204/204), done.
Delta compression using up to 4 threads.
Compressing objects: 100% (91/91), done.
Writing objects: 100% (203/203), 2.65 MiB | 21.00 KiB/s, done.
Total 203 (delta 111), reused 202 (delta 111)
remote: Resolving deltas: 100% (111/111), done.
To github.com:xxx/xxx.git
7838db7..e4721c9 master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
上传github文件及所出现的问题的更多相关文章
- git 上传本地文件到github
git 上传本地文件到github 1 git config --global user.name "Your Real Name" 2 git config --global u ...
- 两种方法上传本地文件到github
https://www.jianshu.com/p/c70ca3a02087 自从使用github以来,一直都是在github网站在线上传文件到仓库中,但是有时因为网络或者电脑的原因上传失败.最重要的 ...
- 两种方法上传本地文件到github(转)
自从使用github以来,一直都是在github网站在线上传文件到仓库中,但是有时因为网络或者电脑的原因上传失败.最重要的原因是我习惯本地编辑,完成以后再一起上传github.看过了几个教程,总结出最 ...
- 上传本地文件到GitHub上
问题解决 今天在windows上上传本地文件到github,出现用户名和仓库不匹配的情况,解决方式如下: 打开控制面板,选择用户账户 把该删除的账户删除一下就行了. 上传文件的步骤如下: 将上传的文件 ...
- GitHub上传本地文件
基本条件:安装GitHub,安装成功之后:(windows系统) 1.安装完成后,还需要一步设置,在命令行输入: $ git config --global user.name "Your ...
- Github Upload Large File 上传超大文件
Github中单个文件的大小限制是100MB,为了能突破这个限制,我们需要使用Git Large File Storage这个工具,参见这个官方帖子,但是按照其给的步骤,博主未能成功上传超大文件,那么 ...
- 上传本地文件到github仓库基本操作
上传文件到github时老师忘记指令,或者总是出一些错,每次都要百度浪费时间,因此将常用操作指令归纳卸载这里,以后再也不要担心百度找帖子了... 第一步:新建仓库 新建仓库步骤省略,最后我们得到一个仓 ...
- 上传本地文件到github(码云)上(小乌龟方式,sourcetree方式)
一:上传文件到 github 1.打开 https://github.com/ 登录github账号(没有的自己创建),点击右上角创建新仓库 在打开的页面中填写 名字 点击 Create repos ...
- Git安装及密钥的生成并上传本地文件到GitHub上
之前用的GitHub,不太熟练,一直在上传的过程中遇到了一些问题,看了网上诸多教程,总觉得很乱,特参考一些资料,总结了一篇完整的操作步骤,从下载安装到上传文件,亲测有效 1.下载Git软件:https ...
随机推荐
- HTTP的基本原理
用户访问万维网文档,万维网文档之间的链接以及万维网文档中数据传送到用户计算机,这些功能的实现都是由超文本传输协议 HTTP(HyperTextTransfer Protocol) 负责完成的. HTT ...
- leetcode — search-a-2d-matrix
/** * Source : https://oj.leetcode.com/problems/search-a-2d-matrix/ * * * Write an efficient algorit ...
- 聊聊Flexbox布局中的flex的演算法
到目前为止,Flexbox布局应该是目前最流行的布局方式之一了.而Flexbox布局的最大特性就是让Flex项目可伸缩,也就是让Flex项目的宽度和高度可以自动填充Flex容器剩余的空间或者缩小Fle ...
- Perl和操作系统交互(一):system、exec和反引号
调用操作系统命令:system函数 system函数可以直接让perl调用操作系统中的命令并执行. system入门示例 例如: #!/usr/bin/perl system 'date +" ...
- python的dir()和__dict__属性的区别
只要是有属性的数据对象(不一定是面向对象的对象实例,而是指具有数据类型的数据对象),都可以通过__dict__和dir()来显示数据对象的相关属性. __dict__可以看作是数据对象的名称空间,所以 ...
- python属性管理(1):基础
管理属性的几种方式 在python中访问.设置.删除对象属性的时候,有以下几种方式: 使用内置函数getattr().setattr()和delattr() 自己编写getter().setter() ...
- git常用命令总结(资源来自廖雪峰)
自己把命令弄出来方便以后看看,,应该有错的emmmm 原文地址:https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67 ...
- [PHP] 理解依赖注入
两个类有依赖关系的时候 使用者通过构造函数参数,方法或属性等方式将具体组件,传给自己 $storage=new Storge(); //构造函数注入 class User{ public functi ...
- Mac下安装最新版本的Graphviz
由于版本兼容问题,Mac下Graphviz之前一直装的是低版本的2.36.高版本的安装方法如下: 1.log in & download Xcode an Xcode Command Line ...
- 深入理解SpringCloud与微服务构建
旭日Follow_24 的CSDN 博客 ,全文地址请点击: https://blog.csdn.net/xuri24/article/details/81742534 目录 一.SpringClou ...