今天给大家分享一下如何从idea提交代码到gitee上面。

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(1)

1.先在gitee上创建仓库

gitee地址:https://Gitee.com/

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(2)

2.填写相应的信息

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(3)

3.下载git(git地址:https://git-scm.com/downloads)

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(4)

直接next一站式安装

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(5)

4.鼠标右键点击 Git Bash Here , 通过执行以下命令设置提交代码时的用户信息

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(6)

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(7)

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(8)

5.打开idea -> File -> Settings -> Plugins -> 搜索gitee并下载(之后重启idea)

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(9)

6.如下图配置用户名及密码

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(10)

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(11)

7.创建 git 本地仓库

VCS --> Import into Version Control --> Create Git Repository

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(12)

8.选择一个文件夹作为git的本地仓库(用于存放项目的源代码)

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(13)

此时可以看见项目文件的颜色变成了红色

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(14)

9.选择项目点击鼠标右键 -> Git -> Add ,Add过后的文件颜色会变为绿色

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(15)

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(16)

10.再次点击鼠标右键 -> 选择Git -> Commit Directory(将缓存区中的文件内容保存至本地仓库,文件为绿色说明可以Commit)

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(17)

然后直接commit就可以了

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(18)

11.选择项目再次点击鼠标右键 -> 选择Git -> Push ,将项目文件推送到gitee

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(19)

12.第一次提交需要填写创建gitee仓库的地址( 点击Define Remote 出现如下图)

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(20)

在gitee中选择要存放的仓库地址,如图点击克隆/下载复制仓库地址并填写在上图URL中即可

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(21)

13.当第二次提交时,不需要再填写URL地址,如果要更换仓库地址,点击origin直接更换URL就可以了

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(22)

14.Push完成后就可以在gitee上面看见自己提交的代码了

GitHub首本IDEA提交代码到git操作手册(GitHub首本IDEA提交代码到git操作手册)(23)

,