前期准备
注册GitHub账号、创建GitHub仓库、项目部署到GitHub需要。
教程 :GitHub创建仓库教程
下载Git: https://git-scm.com/
安装Git:https://www.cnblogs.com/wj-1314/p/7993819.html
IDEA上的操作
1.在IDEA上配置Git、GitHub
File-->setting-->Vsersion Control-->Git 选择已安装的Git路径bin目录下的git.exe
File-->setting-->Vsersion Control-->GitHub 添加绑定GitHub账号
2.创建本地Git仓库
VCS -->Import into Version Control -->Create Git Repository 选中当前项目-->成功后项目会发生变化如图四所示
3.添加项目到Git
Git-->add 项目发生变化文件变成绿色
4.提交项目到Git
Git-->commit Directory 填写提交信息、选择提交。
提交后项目变成白色
5.提交项目到GitHub
如提交项目出现以下错误,参照连接https://blog.csdn.net/donkor_/article/details/77502800
Warning: Permanently added the RSA host key for IP address '192.29.255.115' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists
VCS--->Import into Version Control -->share Project on GitHub
填写信息Repository name:仓库名
Remote:远程路径
Description:提交信息
表示成功上传;可到GitHub上查看
6.更新项目并同步到GitHub上
更新或新添加的项目为绿色
项目右键 Git--->commit Directory--->Commit and push
Commit and push :提交并同步到GitHub
成功提交
上GitHub上查看已同步
7.GitHub项目更新到本地项目
Git --> Repository --> pull
点击 pull 就可以了