git常用命令

来源:互联网 发布:e店宝官方下载3.0 mac 编辑:程序博客网 时间:2024/06/04 17:48

1.获取github代码
使用ssh-keygen生成本地密钥对.ssh-keygen -t rsa -C “youremail@example.com”

在Linux键入ssh-keygen -t rsa -C "xxxxxxx@sina.com"一路enterroot@spider:/# ssh-keygen -t rsa -C "xxxxxxx@sina.com"   Generating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa):          Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa.Your public key has been saved in /root/.ssh/id_rsa.pub.The key fingerprint is:0a:33:ab:90:a6:6e:af:3d:3d:47:08:d8:ce:69:6f:e9 xxxxxxx@sina.comThe key's randomart image is:+--[ RSA 2048]----+|                 ||                 ||  o              || . o             ||  o * . S        || . = * o         ||o.. + +          ||oo.o * .         ||+o+o+Eo          |+-----------------+/root/.ssh/会生成 id_rsa,id_rsa.pub两个密钥。将id_rsa.pub公钥公布给other,other发消息给你的时候会将消息用你的公钥加密,你收到消息采用私钥解密。(采用公钥加密的内容只能私钥才能解开)。将id_rsa.pub的内容贴到github的ssh-key保存之后即可。sudo git clone git@github.com:githubname/proname.git获取对应代码

2.提交github

先告诉github你是谁git config --global user.name "yourname"git config --global user.email "yourname@domain.com"git add test.txtgit commit -m "add a file named test.txt"git push origin master提交成功

3.常用git命令
这里写图片描述

0 0
原创粉丝点击