如果没有使用过Git,大概这样理解一下:开发者(我们)从服务器克隆了一份数据库到本地,开发过程中,我们在分支中修改代码,然后先向本地提交数据,最后再向服务器push数据
一
注册github账号
新建仓库
二
windows下安装msysgit客户端
https://code.google.com/p/msysgit/downloads/list
我下载的是msysGit-fullinstall-1.8.4-preview20130916.exe;
三
配置
1.在本地创建ssh key
$ ssh-keygen -t rsa -C "邮箱全称"回车后首先让你确认存放路径(一般在C:/Users/你的计算机名/.ssh/id_rsa.pub)
再回车,然后定义你的passphrase(两次)
2.回到Github主页设置SSH Key
选择Account Settings
选择SSH Keys
接着
随便定义一个title
进到C:/Users/你的计算机名/.ssh/ 用记事本打开 id_rsa.pub复制其中的内容填入到下面的key中
点击Add key
回到msysgit 测试一下
$ ssh -T git@github.com


配置一下信息 每次提交的时候github会记录这些信息
$ git config --global user.name "自定义名字"
$ git config --global user.email "邮箱全称"
四 新建一个路径,新建一个与repository同名的文件夹 在msysgit中cd到新建的文件夹下 运行:git init


git
remote add origin git@github.com:用户名
/仓库名
.git
提交到github
运行:
git push origin master
这时候会要求你输入SSH Key的passphrase才能成功提交

