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. junit使用中的一些问题

    之前开发过程中的测试,不是使用main方法,就是启动项目调用地址,尤其是后者,测试起来非常不方便,今天配置了下junit,中间遇到些问题,记录如下. 首先下载spring-test.jar包和juni ...

  2. CAD安装失败怎样卸载CAD 2011?错误提示某些产品无法安装

    AUTODESK系列软件着实令人头疼,安装失败之后不能完全卸载!!!(比如maya,cad,3dsmax等).有时手动删除注册表重装之后还是会出现各种问题,每个版本的C++Runtime和.NET f ...

  3. HDU 5375——Gray code——————【dp||讨论】

    Gray code Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total S ...

  4. CentOS7中添加新硬盘

      cp /etc/fstab /etc/fstab.bak echo /dev/vdb1 /mnt/disk1 ext4 defaults 0 0 >> /etc/fstab mkdir ...

  5. 乐蜂网SALES倒计时原码展示

    这是一个基于jquey写的倒计时.当然代码有点小改动,只是改了一下展示效果. 在静态页添加显示倒计时的容器,并引用下面脚本,代入时间参数即可使用. timeoutDate——到期时间,时间格式为201 ...

  6. 给主程序签名及第三方dll强签名

    给主程序添加签名   添加完成后会自动生成一个*.pfx文件.     给程序添加强签名方法:   本文以Quartz.dll为例,使用vs Tools下的工具命令.   打开命令工具是这个样子,   ...

  7. vue的ajax

    vue的ajax常见的有两种 ,一种是 vue-resource,一种是axios vue-resource: 是vue的插件,非官方库, vue1.x 使用广泛 如何使用: 先在vue的脚本架上安装 ...

  8. JavaScript库 — — React

    React不支持IE6.IE7 React是什么?用于构建用户界面的JAVASCRIPT库,是MVC中的V(视图). React特点:1. 声明式设计2. 减少与DOM的交互,高效3. JSX - J ...

  9. Android中快速实现自定义字体!

    前言:我们都知道,Android中默认的字体是黑体,而大多数app也都是使用的这种字体,但我们发现,大多数app中,个别地方字体非常好看,例如app的标题栏,菜单栏等地方,那他们是怎么做到的呢?有两种 ...

  10. 【工作中学习】CreateProcessAsUser失败,错误码:1314

    事情起因是这样, 产品的Windows服务(Service)之前一直是用Local System Account在运行的,但这个版本有需求要换成使用普通的Domain User来运行,如下图: 但却出 ...