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. SQL Server Reporting Service(SSRS) 第五篇 自定义数据处理扩展DPE(Data Processing Extension)

    最近在做SSRS项目时,遇到这么一个情形:该项目有多个数据库,每个数据库都在不同的服务器,但每个数据库所拥有的数据库对象(table/view/SPs/functions)都是一模一样的,后来结合网络 ...

  2. c++中 函数的默认参数 学习

    默认参数指的是当函数调用中省略了实参时     自动使用一个默认的值. 对于带参数列表的函数,必须从右向左添加默认值  (就是说她的右边肯定是先有默认的值) fun(int ,1,2,3) 不能 fu ...

  3. [转]让你的网页文本框增加光晕效果与提示,水印(类似QQ2011)

    本文转自:http://www.cnblogs.com/xiaofengfeng/archive/2013/01/28/2880344.html 让你的网页文本框增加光晕效果(类似QQ2011) 我们 ...

  4. 深入学习webpack(四)

    更多内容可以看此文档.

  5. 04-cglib(code generator library)代理(没有接口)

    1 UserServiceProxyFactory4代码 package www.test.c_proxy; import java.lang.reflect.Method; import org.s ...

  6. Makefile2

    规范 target可以是Object file, 可执行文件或者标签(标签一般没有依赖) 越靠近最终结果的target卸载越前面 定义target前, 定义CC, SRC, CFLAGS, OBJS, ...

  7. Homemade Script Language: RED

    Made by C, named after RED(RecovEr from SaDness) 欢迎批评 :)

  8. Oracle Functions转成Ms-Sql procedure

    最近公司的一些Oracle项目要转到Ms_sql上,在把Oracle Functions改成MS-Sql的Procedure时,遇到了翻译的问题. 罗列出这些问题: 一.Oracle 基本类型 ora ...

  9. RN的打包

    1.首先执行以下命令 在android目录下 keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -key ...

  10. 测试驱动开发(TDD)及测试框架Mocha.js入门学习

    组里马上要转变开发模式,由传统的开发模式(Developer开发,QA测试),转变为尝试TDD(Test-driven development,测试驱动开发)的开发模型.由此将不存在QA的角色,或者仅 ...