github使用笔记【缓慢更新】

-------------------------------------
2016.2.3


安装gitbash


类linux命令行操作


打开bash


git config --global user.name "名字"


git config --global user.email"邮箱"


cd f:


cd git


git init


cd study


cd html5


git add readme.txt
fatal:pathspec 'readme.txt' did not match files
//原因,错认为add是创建,其实是将文件提交到暂存区
//此时我有疑惑,流程上,应该先验证我是否又提交资格。
//于是我去在~/git/study/html5/ 下创建readme.txt


git commit -m"readme.txt提交"
*** Please tell me who you are.


Run


  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"


to set your account's default identity.
Omit --global to set the identity only in this repository.


fatal: empty ident name (for <Zeac@Zeac-PC.(none)>) not allowed
//此时需要我告诉他我的身份。而我此时以为,我在网站上建的仓库是公用的。
//所有人不需要持有我的密码(未经我的允许即可提交),感到不合逻辑。
//但是之前已经输入了邮箱和名字,为什么还这样问?
//网上查之,需要ssh链接。
//首先是本地创建ssh key.
//这个东西类似于个人身份证(机器的)


$ ssh-keygen -t rsa -C"邮箱"


Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Zeac/.ssh/id_rsa):
Created directory '/c/Users/Zeac/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Zeac/.ssh/id_rsa.
Your public key has been saved in /c/Users/Zeac/.ssh/id_rsa.pub.
The key fingerprint is:
**********************************
The key's randomart image is:
+---[RSA 2048]----+
|       ..+o o.++=|
|      . +. + o o.|
|     . o. . .   .|
|    o .  o .   . |
|     o  . + +   .|
|      .. = *  . .|
|      .oo + o.oE |
|     .+o.o o.=.. |
|      +*=o..+++  |
+----[SHA256]-----+


//会提示你将ssh的文件保存在什么地方
//不太懂,一路回车
//最后创建完毕



ssh -T git@github.com
The authenticity of host 'github.com (2.22.22.222)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Please type 'yes' or 'no': yes
Warning: Permanently added 'github.com,22.22.22.222' (RSA) to the list of known hosts.
Permission denied (publickey).


//尝试链接,失败
//此时疑惑,我已经拥有ssh了,怎么无法链接
//我的密码怎么没有用到?
//网上查之,原来需要将ssh.pub里面的字符串,复制到github里面。
//此时明白,原来,当多人协同工作时,不是任何一个非组织之外的人都有权利修改
//需要和账号拥有者协商(网上创建项目的人),然后将自己的ssh提供给账号拥有者,在项目里导入你的ssh(add deploy key),这样你就有权利去提交项目。






git clone https://github.com/用户名/项目名.git
Cloning into '项目名'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.


//会发现当前目录下有这个项目名 命名的文件夹,该文件夹下是你的项目文件。
//我的github项目目前是空的,所有我需要提交。


//新的文件目录 ~/项目/study/html5/html5.html readme.txt


git add study
//提交到暂存区


git commit -m'解释'
//提交到本地仓库


git push -u origin master
//提交到网上仓库


Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (6/6), 1.27 KiB | 0 bytes/s, done.
Total 6 (delta 0), reused 0 (delta 0)
To https://github.com/用户名/项目名.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.


-----------------------------------------------------------------------
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值