绑定账号
1、File->Settings->Version Control->Github

Settings.png
会出现github,然后在旁边输入你github的用户名和密码,可以点击”test”测试一下,如果出现:Connection successful
,则代表连接成功了。

OK.png
2、选择Git安装路径
设置github后选择git,输入你git.exe的安装位置路径,下面是我的git.exe的位置:D:Gitingit.exe
,然后点击OK
。

git.png
创建Github的仓库
1、VCS->Import Into Version Control->Share Project On Github

share.png
然后会弹出框让你输入一个仓库名(不能为中文)

create repository.png
然后点击share

share.png
然后会弹出让你选择哪些文件需要被同步,选好后,在下面的commit Message可以输入自己的信息,然后点OK,你的代码就提交到网上了。可以看看

github.png
修改后的文件提交
1、对修改后的文件或目录点击右键:Git—>Add,先把文件放入暂存区。

add.png
2、对修改后的文件或目录点击右键:Git—>Commit File,把刚才add放在暂缓区的文件提交。

commit.png
3、填好commit的信息后,点击下面的commit and Push,可以直接提交到网上。

commit and push.png

push.png
转自:http://www.jianshu.com/p/f58e38f38594