1.Windows环境下,最简便快捷的方法是使用msysGit,下载地址:http://msysgit.github.io/
2.初始设置:(确保已有github账户)
(1)设置姓名和邮箱地址:
$ git config --global user.name "Firstname Lastname"
$ git config --global user.email "your_email@example.com"
(2)设置SSH Key:
$ ssh-keygen -t rsa -C "your_email@example.com"
(3)添加公开密钥:
$ cat ~/.ssh/id_rsa.pub
ssh-rsa 公开密钥的内容 your_email@example.com
(4)将公开密钥内容添加到Github:
github中选择Your settings ->SSH Keys 粘贴即可
3.创建repository,然后git clone到本地,将代码添加进去:
$ git clone xxx
4.执行以下命令,即可上传代码至github:
$ git add .
$ git commit -m “xxx”
$ git push
表示上传成功!!!