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)的更多相关文章

  1. git提交代码报错 trailing whitespace的解决方法

    1. git提交代码报错 trailing whitespace 禁止执行pre-commit脚本 进入到项目目录中 chmod a-x .git/hooks/pre-commit 2.git提交代码 ...

  2. 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 ...

  3. git 提交代码报错failed to push some refs to 解决笔记

    Administrator@SC- MINGW64 /e/gitrepository (master) $ git push django master To github.com:zgc137/dj ...

  4. Git添加远程报错:remote origin already exists.

    在本地创建了一个Git仓库,如何在Github创建一个Git仓库,并且让这两个仓库进行远程同步,这样Github上的仓库既可以作为备份仓库,还可以通过该仓库进行多人协作. 1.登录github,建立一 ...

  5. 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目录 ...

  6. 在使用 Git pull 时候报错 error: inflate

    在使用 Git pull 时候报错 error: inflate 具体的错误是 这样的 error: inflate: data stream error (unknown compression m ...

  7. spark提交任务报错: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes

    spark提交任务报错: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes ...

  8. 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 ...

  9. svn 提交代码报错

    svn 提交代码报错 最近新安装了TortoiseSvn 1.92,在上传代码,其中有新增加的文件,出现如下错误: 解决方法: 1.用vs生成patch文件 2.生成的patch文件中讲nonexis ...

随机推荐

  1. SpringBoot中使用Servlet

    1.在入口Application类上加入注解@ServletComponentScan @SpringBootApplication @ServletComponentScan public clas ...

  2. grunt 合并压缩js和css文件(二)

    具体node及文件配置请看: grunt 安装使用(一) 要压缩的文件 --src/ ajax.js assets.js touch.js zepto.js 目录结构: dist/ node_modu ...

  3. RTT之内存管理及异常中断

    内存管理分静态内存管理和动态内存管理(根据大小又分2种) 静态内存管理:创建.删除.初始化.解绑.申请和释放.初始化内存池是属于静态内存管理,与创建内存池不同的是,此处内存池对象所使用的内存空间是由用 ...

  4. strchr和strstr函数

    二者都属于c的库函数   包含在<string.h>函数中 不同的是 : strchr是查找单个字符在串中出现的位置 strstr查找的是字符串在串中出现的位置 看代码: //strchr ...

  5. 性能测试工具LoadRunner31-LR之链接mysql

    步骤: 1.建好mysql数据库并启动 2.下载libmysql.dll,放到保存脚本的文件夹下 3.编写脚本并运行 Action() { int rc; //定义状态变量,0表示成功,非0表示失败 ...

  6. [转]js add month 加n月

    本文转自:http://stackoverflow.com/questions/5645058/how-to-add-months-to-a-date-in-javascript/5645126 I ...

  7. 使用mongoosejs链接Mongodb

    以前只是了解Nodejs 这回打算好好学学.学到熟练使用的程度 var options={ user:'test_user', pass:'123456' }; mongoose.connect('m ...

  8. Xtrareport 多栏报表

    首先看下布局designer 细节: 分组一定要用到GroupHeather 设置好有 右边会出现 接下来是代码部分 Form1中代码 using DevExpress.XtraReports.UI; ...

  9. 对DOM操作的一些总结

    一.DOM节点 分为三大类: 1.元素节点 :<html>.<body>.<p>等标签 2.文本节点 :标签内的文本.例如<p>这就是文本节点</ ...

  10. dojo query 基本用法

    1. 常用的 dojo.query 用法 dojo.query("#header > h1") //ID 为 header 的元素的直接子节点中的 h3 元素   dojo. ...