首先需要一个GitHub的账号
账号创建地址:https://github.com/join?source=header-home
下载安装Git:https://gitforwindows.org/
打开Git Bash
可以按win键再查找
设置全局的账户,邮箱
在命令行中输入:
git config --global user.name "你的GitHub的帐户名"
git config --global user.email "你的GitHub绑定的邮箱"
![](https://img2018.cnblogs.com/blog/1904401/202001/1904401-20200104124850229-1227712725.png)
在idea中进行配置
1.配置File > Settings > Version Control > Git
在Path to Git executable: 中填写git.exe的路径
![](https://img2018.cnblogs.com/blog/1904401/202001/1904401-20200104125859758-1173415128.png)
2.配置后点击Test检查是否设置成功(idea版本2019.1.3)![](https://img2018.cnblogs.com/blog/1904401/202001/1904401-20200104130530499-291244489.png)
若成功则会弹出
![](https://img2018.cnblogs.com/blog/1904401/202001/1904401-20200104130034764-2055202378.png)
3.配置 File > Settings > Version Control > GitHub
添加账户点击 + 或者add account
![](https://img2018.cnblogs.com/blog/1904401/202001/1904401-20200104130559798-167000944.png)
配置完成后点击右下角Apply 和 OK
![](https://img2018.cnblogs.com/blog/1904401/202001/1904401-20200104130957752-1591879022.png)
创建本地Git仓库
1.点击工具栏中的VCS > Import into Version Control > Create Git Repository...
![](https://img2018.cnblogs.com/blog/1904401/202001/1904401-20200104131445101-274797191.png)
2.选择你想要放入本地Git仓库的项目所在的目录
![](https://img2018.cnblogs.com/blog/1904401/202001/1904401-20200104131650390-1009978623.png)
此时你的文件会变成红色
![](https://img2018.cnblogs.com/blog/1904401/202001/1904401-20200104131915451-2021445200.png)
3.反键你需要放入本地Git仓库的部分的文件夹或者文件
Git > add
![](https://img2018.cnblogs.com/blog/1904401/202001/1904401-20200104132250055-1475354306.png)
此时你的文件会变成绿色
![](https://img2018.cnblogs.com/blog/1904401/202001/1904401-20200104132348945-1882111063.png)
3.反键你需要上传的部分的文件夹或者文件
Git > Commit Directory...(此时才是真正的提交到本地Git仓库)
![](https://img2018.cnblogs.com/blog/1904401/202001/1904401-20200104133522854-1450482245.png)
成功后文件会变成白色
![](https://img2018.cnblogs.com/blog/1904401/202001/1904401-20200104134006836-1213118092.png)
将本地Git仓库中的文件上传到GitHub
1.点击工具栏中的VCS > Import into Version Control > Share Project on GitHub
![](https://img2018.cnblogs.com/blog/1904401/202001/1904401-20200104134226450-1750563130.png)
2.填写上传到GitHub上后的仓库名和简介
并点击Share
![](https://img2018.cnblogs.com/blog/1904401/202001/1904401-20200104134359668-811092345.png)
上传成功后GitHub上的仓库结构
![](https://img2018.cnblogs.com/blog/1904401/202001/1904401-20200104134452549-960982980.png)