git与github

1、安装git客户端*
2、生成**
$ ssh-****** -t rsa -C "注册邮箱"
然后用户主目录~/.ssh/下有两个文件,id_rsa是私钥,id_rsa.pub是公钥
3、获取key,打开.ssh下的id_rsa.pub文件,里面的内容就是key的内容
$ start ~/.ssh/id_rsa.pub
备注:使用外部工具打开文件
cat ~/.ssh/id_rsa.pub 输出控制台

4、 登录GitHub,打开"SSH Keys"页面,快捷地址:https://github.com/settings/ssh

git与github

5、验证
ssh –T [email protected]
如果是第一次操作,会出现让你输入yes或no,选择yes就行

7、其他配置
git config --global user.name “用户名”
git config --global user.email “邮箱”

8、连接已完成,开始进入本地如何上传到github
9、在github上创建项目,复制url https://github.com/mglue/my-works
10、本地初始化
git init
11、进入暂存状态
git add *.php
12、添加远程github地址
git remote add origin https://github.com/mglue/my-works
13、本地提交给github
git push -u origin master
使用push之前先pull
git pull origin master --allow-unrelated-histories
允许不同项目