git提交远程报错[rejected] master -> master (fetch first)
1 先下载git for windows
然后一直点下一步安装.
2 安装之后,选择git gui.生成ssh 链接 git 公钥.
用命令也可以:
$ ssh-keygen -t rsa -C "your_emali@youemal.com"
然后输入密码.
建议用第一种方式。第二种网上说是可以,但是我没成功过。
然后输入密码。
3 将公钥添加到开源中国上,或者是github中
在开源中国中新建一个公钥,然后将.ssh文件夹下的id_ras_pub中的内容复制到文本框中,这里的title可以随意.
4 测试链接:
输入命令:$ ssh -T git@git.oschina.net
然后输入yes
如果成功可以看到你的用户名和邮箱.
出现错误可以测试:$ ssh -Tv git@git.oschina.net
5 设置用户名和邮箱
$ git config user.name"you name"
$git config user.email"you_email@youemal.com"
6 然后在web开源中国中创建一个project.
7 测试上传文件
创建文件夹,需要和你建立的projexct同名。
mkdir hello
cd hello
git init
touch README
git add README
git commit -m 'frist commit'
8 提交
git remote add test git@git.oschina.net:web用户名/hell.git
git push -u test master
如里有报错误:
To git@git.oschina.net:yangzhi/hello.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@git.oschina.net:yangzhi/hello.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushin
hint: to the same ref. You may want to first merge 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 push -f
可以ok了.
10 克隆代码
git clone git@github..com:用户名/项目名.git
来源:http://www.xuebuyuan.com/651322.html
git提交远程报错[rejected] master -> master (fetch first)的更多相关文章
- git提交代码报错 trailing whitespace的解决方法
1. git提交代码报错 trailing whitespace 禁止执行pre-commit脚本 进入到项目目录中 chmod a-x .git/hooks/pre-commit 2.git提交代码 ...
- Git提交代码报错Git push error:src refspec XXX matches more than one解决方案
Git提交代码push时,报错这个 error: src refspec master matches more than one. error: failed to push some refs t ...
- git 提交代码报错failed to push some refs to 解决笔记
Administrator@SC- MINGW64 /e/gitrepository (master) $ git push django master To github.com:zgc137/dj ...
- Git添加远程报错:remote origin already exists.
在本地创建了一个Git仓库,如何在Github创建一个Git仓库,并且让这两个仓库进行远程同步,这样Github上的仓库既可以作为备份仓库,还可以通过该仓库进行多人协作. 1.登录github,建立一 ...
- git提交代码报:fatal: Unable to create 'E:/testGit/test/.git/index.lock': File exists.
git提交代码报错,提示:fatal: Unable to create 'E:/testGit/test/.git/index.lock': File exists. 具体截图如下: 在.git目录 ...
- 在使用 Git pull 时候报错 error: inflate
在使用 Git pull 时候报错 error: inflate 具体的错误是 这样的 error: inflate: data stream error (unknown compression m ...
- spark提交任务报错: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
spark提交任务报错: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes ...
- git切换分支报错:error: pathspec 'origin/XXX' did not match any file(s) known to git
项目上有一个分支test,使用git branch -a看不到该远程分支,直接使用命令git checkout test报错如下: error: pathspec 'origin/test' did ...
- svn 提交代码报错
svn 提交代码报错 最近新安装了TortoiseSvn 1.92,在上传代码,其中有新增加的文件,出现如下错误: 解决方法: 1.用vs生成patch文件 2.生成的patch文件中讲nonexis ...
随机推荐
- 01-消息中间件概述和ActiveMq入门
1.mq解决的问题 系统异步处理 应用解耦 流量削峰 日志处理 消息通信 2.消息中间件的2中模型 2.1 Point-to-Point(P2P) / 点对点 / 类比:送快递 特点: + 一个消费生 ...
- Django orm查询操作
基于双下划线查询切记!!!!正向查询按字段,反向查询按表名的小写 正向:在Book表里设置关联Obj表,Book------>Obj就是正向查询 反向:在Book表里设置关联Obj表,Obj-- ...
- [一点一滴.NET]前台线程和后台线程
前台线程和后台线程就是通过线程实例的属性IsBackground=true or false来区分的. 新建一个线程是默认是后台线程. 前台线程全部执行完之后,才退出进程. 进程退出,所有的后台线程全 ...
- c++关于map的find和count的使用
编程的时候比较常用,今天记录一下,以后备用. 使用count,返回的是被查找元素的个数.如果有,返回1:否则,返回0.注意,map中不存在相同元素,所以返回值只能是1或0. 使用find,返回的是被查 ...
- ETL模型设计
传统的关系数据库一般采用二维数表的形式来表示数据,一个维是行,另一个维是列,行和列的交叉处就是数据元素.关系数据的基础是关系数据库模型,通过标准的SQL语言来加以实现. 数据仓库是多维数据库,它扩展了 ...
- HDU 4349——Xiao Ming's Hope——————【Lucas定理】
Xiao Ming's Hope Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- 微信小程序获取数据、处理数据、绑定数据关键步骤记录
onload:function(event){ var inTheatersUrl ="https://api.douban.com"+"/v2/movie/in_the ...
- AutoResetEvent 2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- asp.net 翻页时用ViewState保存上一页checkbox勾选的值
/// <summary> /// checkbox勾选取消勾选事件 /// </summary> /// <param nam ...
- css3实现iPhone滑动解锁
该效果的主要实现思路是给文字添加渐变的背景,然后对背景进行裁剪,按文字裁剪(目前只有webkit内核浏览器支持该属性),最后给背景添加动画,即改变背景的位置,背景动画效果如下(GIF录制时有卡顿,代码 ...