git经常使用命令

怎么获取SSH Key?git

第一次获取远程的git代码时,本地没有ssh key,使用如下命令能够生成(注意:yufeng.x是用户名):
ssh-keygen -t rsa -C "yufeng.x"ssh

一直按回车,最后获得两个文件:id_rsa和id_rsa.pub
Your identification has been saved in /Users/xieyufeng/.ssh/id_rsa.
Your public key has been saved in /Users/xieyufeng/.ssh/id_rsa.pub.
经过cat命令显示ssh key:
cat /Users/xieyufeng/.ssh/id_rsa.pubide

 

clone 仓库gitlab

git clone git@gitlab.com:yufeng.x/mywork.git命令行

查看远程仓库地址code

git remote -vcdn

上传代码blog

上传代码很简单,主要是3个命令行:
(1) git add -A
(2) git commit -m “版本描述”
这两个命令行只是本地库,创建索引,代码并无传到远程库。
screenshot
(3) git push --all
经过push 把HEAD中的索引指向的代码提交到远程仓库。索引

相关文章
相关标签/搜索