1、创建本地项目仓库,选中本地的项目
![在这里插入图片描述](https://img-blog.csdnimg.cn/a23e86d9f138465ab0d99936a69e1696.png)
![在这里插入图片描述](https://img-blog.csdnimg.cn/191aea2a0e30481f8be4dfd692190fca.png)
2、右击项目名称,选择add-提交代码到git
![在这里插入图片描述](https://img-blog.csdnimg.cn/fcf755d260e941f9bf97da232295241a.png)
3、git仓库中创建空白版本库,复制url
4、git —commit
5、git —push中填入仓库的url
6、idea中commit比较慢,可以用git bash命令行执行
添加远程仓库地址
git remote add origin https://github.com//.git
添加文件
git add .
提交代码
git commit -m “init project”
push 代码
git push -u origin master