在idea中上传本地代码到github中需要使用到git,可以在git官网下载,
然后选择位置安装,一路点击下一步即可。
在github的右上角,点击加号下方的 New repository --> 在Repository name输入框中输入远程仓库名 ---->在Description (optional)输入框中添加对项目的描述 --->然后点击下方的绿色按钮,创建远程仓库完成。
在idea中打开Terminal
git初始化本地仓库
在命令行中输入
git init
将本地代码提交到本地仓库中
在命令行中输入
git add *
git commit -m '提交内容的描述'
//注意,单引号内输入对本次提交的内容的描述,不写会出错
将本地仓库与远程仓库进行绑定,并且push
git remote add origin 你的远程仓库的URL
//例如
git remote add origin https://github.com/gujunling/test.git
//将代码提交到github上
git push origin master
示例:
上传后github中远程仓库效果
//clone下的代码仓库会自动与你克隆那个远程仓库绑定
//例如
git clone https://github.com/gujunling/test.git
//将github中的最新代码再更新到本地
git pull origin master
原文:https://www.cnblogs.com/gujun1998/p/11375625.html