码迷,mamicode.com
首页 > Web开发 > 详细

上传本地文件到github

时间:2017-09-14 00:30:24      阅读:235      评论:0      收藏:0      [点我收藏+]

标签:git   with   config   flow   令行   fat   already   man   key   

第一步:创建新的仓库

技术分享

勾选Initialize this repository with a README选项,自动创建REAMDE.md文件。

第二步:

  $ git config --global user.name "hanyuntao"

  $ git config --global user.email "hanyuntaocn@163.com"

第三步:生成ssh key

首先检查是否已生成密钥cd ~/.ssh,如果返回的ls有3个文件,则密钥已经生成。

如果没有密钥,通过

  $ ssh-keygen -t rsa -C "470613423@qq.com"

生成,生成过程中一路按3次回车键就好了。

生成成功后,去对应目录找到id_rsa.pub用记事本打开,得到ssh key公钥。

第四步:为github账号配置ssh key

技术分享

技术分享

第五步:在Git Shell下输入命令测试刚才的公钥是否认证正确。

  ssh -T git@github.com

正确结果会显示:

  Warning:Permanently added ‘github.com,207.97.227.239‘ (RSA) to the list of known hosts.

  Hi Flowerowl! You‘ve successfully authenticated, but GitHub does not provide shell access.

warning 不用理会。

第六步:切换到Git shell 命令行下,输入命令:

  git init
  git commit -m ‘stumansys‘
  git remote add origin https://github.com/Flowerowl/stumansys.git
  git push origin master

如果执行git remote add origin

  https://github.com/Flowerowl/stumansys.git

,出现错误:

  fatal: remote origin already exists

则执行以下语句:

  git remote rm origin

再往后执行git remote add origin https://github.com/Flowerowl/stumansys.git 即可。

在执行git push origin master时,报错:

  error:failed to push som refs to.......

则执行以下语句:

  git pull origin master  

如果仍然不成功

  git remote set-url origin git@github.com:username/repository

上传过程中大概遇到这些问题。

  

上传本地文件到github

标签:git   with   config   flow   令行   fat   already   man   key   

原文地址:http://www.cnblogs.com/ningningwang/p/7518399.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!