Java|【GitHub & idea】简简单单弄好,不麻烦

idea设置Git.exe settings>version control>git
图片里设置git-cmd.exe错了,应该设的是git.exe
Java|【GitHub & idea】简简单单弄好,不麻烦
文章图片

在idea上登录你的github settings>version control>github>+
Java|【GitHub & idea】简简单单弄好,不麻烦
文章图片

idea上传代码 VCS版本控制 在GitHub上新建储存库 【Java|【GitHub & idea】简简单单弄好,不麻烦】Java|【GitHub & idea】简简单单弄好,不麻烦
文章图片

弄完后,这时push可能会失败 Java|【GitHub & idea】简简单单弄好,不麻烦
文章图片

我猜报错意思是HTTPS协议没有指定,传输不安全,那么进行下面的操作: Java|【GitHub & idea】简简单单弄好,不麻烦
文章图片

把刚刚新建的GitHub储存库链接填写上 Java|【GitHub & idea】简简单单弄好,不麻烦
文章图片

commit Java|【GitHub & idea】简简单单弄好,不麻烦
文章图片

Java|【GitHub & idea】简简单单弄好,不麻烦
文章图片

push成功 (这步成功了就行了,GitHub网页中就能看的上传的代码了)
Java|【GitHub & idea】简简单单弄好,不麻烦
文章图片

下面是用git命令行上传代码
使用Git Bash Java|【GitHub & idea】简简单单弄好,不麻烦
文章图片

命令:
1、…or create a new repository on the command line
…或在命令行上创建新的存储库(常用这个

cd 你的工程目录路径 echo "# lvyouweb" >> README.md//创建README.md文件,写的内容是 lvyouweb git init //初始化 git add README.md//添加README.md文件到github工程 git add . //添加本地工程的所有文件到github工程 git commit -m "first commit" //设置提交信息,会创建github工程的所有内容,相当于clone了本地工程 git remote add origin https://github.com/BIG-BOSS-ZC/lvyouweb.git //绑定https链接 git push -u origin master //上传整个工程

2、…or push an existing repository from the command line
…或从命令行推送现有存储库
git remote add origin https://github.com/BIG-BOSS-ZC/lvyouweb.git git push -u origin master

实际操作演示
Administrator@XGA5P7RIFKTFCDR MINGW64 /e/HTML/Tomcat_pro1 (master) $ echo "# lvyouweb" >> README.mdAdministrator@XGA5P7RIFKTFCDR MINGW64 /e/HTML/Tomcat_pro1 (master) $ git init Reinitialized existing Git repository in E:/HTML/Tomcat_pro1/.git/Administrator@XGA5P7RIFKTFCDR MINGW64 /e/HTML/Tomcat_pro1 (master) $ git add README.md warning: LF will be replaced by CRLF in README.md. The file will have its original line endings in your working directory.Administrator@XGA5P7RIFKTFCDR MINGW64 /e/HTML/Tomcat_pro1 (master) $ git add . warning: LF will be replaced by CRLF in .idea/workspace.xml. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in out/artifacts/Tomcat_pro1_war_exploded/WEB-INF/web.xml. The file will have its original line endings in your working directory. /...省略多行.../ warning: LF will be replaced by CRLF in web/js/npm.js. The file will have its original line endings in your working directory.Administrator@XGA5P7RIFKTFCDR MINGW64 /e/HTML/Tomcat_pro1 (master) $ git commit -m "first commit" [master b44af81] first commit 3838 files changed, 36634 insertions(+) create mode 100644 .idea/artifacts/Tomcat_pro1_war.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/libraries/commons_collections_3_2_1.xml create mode 100644 .idea/libraries/jars.xml create mode 100644 .idea/libraries/lib.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/uiDesigner.xml create mode 100644 .idea/workspace.xml create mode 100644 Tomcat_pro1.iml create mode 100644 out/artifacts/Tomcat_pro1_war_exploded/WEB-INF/classes/META-INF/Tomcat_pro1.kotlin_module /...省略多行.../Administrator@XGA5P7RIFKTFCDR MINGW64 /e/HTML/Tomcat_pro1 (master) $ git push -u origin master Counting objects: 1278, done. Delta compression using up to 4 threads. Compressing objects: 100% (1263/1263), done. Writing objects:35% (453/1278), 27.86 MiB | 155.00 KiB/s

Java|【GitHub & idea】简简单单弄好,不麻烦
文章图片

Java|【GitHub & idea】简简单单弄好,不麻烦
文章图片

回到idea发现,有了变化! 有Git的按钮,蓝色的是update project,绿色的是commit
Java|【GitHub & idea】简简单单弄好,不麻烦
文章图片

    推荐阅读