git实战笔记
一、提交本地代码
首先,在github上新建仓库,并将新项目克隆到本地
git clone git@github.com:antguo/antguo-vue-ui.git
然后,进入新项目目录,将代码存放到新项目的文件夹下
最后,在新项目路径下执行如下命令,完成代码提交
git add .
git commit -m "提交信息说明"
## 提交到master分支
git push origin master
二、克隆代码
首先,在本地生成ssh key
## antguo为github的用户名
ssh-keygen -t rsa -C "antguo"
执行如上命令,一路回车,直到打印如下,则生成ssh成功:
执行如下命令查看生成的ssh:
cat /Users/guowenjun/.ssh/id_rsa.pub
进入github后台,setting->SSh keys->new SSH key
将生成的ssh全部粘贴,title自定义取名字,点击添加即可
克隆项目:
git clone [git项目地址]
克隆地址出现如下错误,是因为没有配置ssh key:
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.