一、Idea配置Git路径:
File--Settings--Version Control--Git,在右侧修改git路径

点Test,若出现下图则集成成功

image.png
二、将代码交给Git管理:
VCS--Enable Version Control Integration


在右上角有提交按钮,默认是没有push按钮的。

三、将Idea默认Terminal的CMD改成git bash
修改之前:

步骤:
File--Settings--搜索框输入terminal--修改右侧Shell path

修改后:

四、将本地仓库与远程仓库关联。
1)将本地的SSH KEY添加到远程仓库中
找到本地工程文件夹--鼠标右键--Git GUI Here

Hlep--Show SSH Key

复制SSH Key

打开GitHub,选择Settings

选择SSH and GPG keys---New SSH Key

输入复制的SSH Key,然后Add即可

2)本地仓库关联远程仓库
GitHub新建项目后,打开IDEA的Terminal窗口,输入以下命令:
git remote add origin git@github.com:ZL6666/Idea-demo.git
然后输入以下命令:
git remote -v
如果出现以下,说明关联远程仓库成功

使用push命令即可将提交后的内容更新到远程仓库中
git push -u origin master
五、IDEA添加Push按钮:
File--Settings--Appearance & Behavior--Menus and Toolbars--Navigation Bar Toolbar--NavBarVcsGroup--VcsNavBarTooBarActions--Update Project--上方添加按钮


找到Version Control Systems,然后拉到最下面,找到Push即可


在菜单栏中就会显示push按钮
