1.在IDEA的Version Control中设置Git(前提:已安装了Git)。 2.在VCS中Create Git Repository,来创建本地git仓库。 3.在项目名处右键,然后点击Git-Add,来将代码提交到本地git仓库。 4.在项目名处右键,然后点击Git-Repository-Remotes,设置远程git地址。 5.在项目名处右键,然后点击Git-Commit Directory,将本地git仓库中代码提交到远程git仓库。