最近学习的东西太多,自我做一个笔记。新手看比较合适。
-
搭建环境,在git官网下载git
-
设置全局参数
git config --global user.name "你的名字" git config --global user.email "你的邮箱"
-
配置sshKey
ssh-keygen -t rsa -C "你的邮箱"
一直回车直到出现The key fingerprint is:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
在日志中查看保存的位置打开复制id_rsa.pub的值复制到github账户的setting-SSH keys and GPG keys中,Title随便写。
验证: ssh -T git@github.com
回显:Hi ***! You’ve successfully authenticated, but GitHub does not provide shell access.
-
在本地你乐意的地方建立文件夹,打开文件夹右键选择git bush here
git init //将该文件夹设置为初始化仓库
将要上传的项目放在文件中
git add .//将所有文件放在仓库中 git commit -m "你想写的标识"
与远程github仓库建立远程连接
git remote add origin git@github.com:AreaZer/SSLS.git
开始push代码
git push -u origin master
当然你可以更改分支进行推送
git branch "新分支的名字" git checkout "新分支的名称" git push -u origin "新分支的名称"
这样就完成了项目的同步