1 初始化git
重新在git设置一下身份的名字和邮箱
git config --global user.name "yourname" # github为yourname git config --global user.email "your@email.com" 这里的yourname必须与github的用户名一致
这里your@email.com必须与github登录邮箱一致
2 设置ssh key
2.1.删除.ssh文件夹下的known_hosts文件(该文件主要作用是域名解析)
2.2.生成 ssh文件
ssh-keygen -t rsa -C "617718074@qq.com" #(填写github对应的邮箱) 一路回车即可,无需输入
2.3. 把生成的.ssh/id_rsa中的key添加到github网站ssh配置[已经备份.ssh文件,可以实现多台pc对一个仓库的管理]
3 常用操作记录
a.在所有空文件夹添加 .gitkeep文件
find . \( -type d -empty \) -and \( -not -regex ./\.git.* \) -exec touch {}/.gitkeep \; b.删除文件从版本库恢复(工作区文件)
git checkout demo.file ; #demo.file 为被删除的文件 c. 创建分支过程 (dev)
git checkout -b dev 查看分支
git branch -a 提交分支
git push origin dev 从分支拉取
git pull origin dev d.查看版本库状态
git status
上一篇:状态估计中的概率基础
下一篇:深入理解PHP数组反转的算法