GitIntelliJ IDEA 提交代码到 GitCode 远程仓库 ( GitCode 创建远程仓库 | 将本地工程推送到 GitCode 远程仓库 | 验证权限 | 生成个人访问令牌 )(代码片

Posted 韩曙亮

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了GitIntelliJ IDEA 提交代码到 GitCode 远程仓库 ( GitCode 创建远程仓库 | 将本地工程推送到 GitCode 远程仓库 | 验证权限 | 生成个人访问令牌 )(代码片相关的知识,希望对你有一定的参考价值。

前言


GitHub 又挂了 , 国内不太好用 , 现在开始使用 gitcode , 地址为 https://gitcode.net ;





一、GitCode 创建远程仓库



点击右侧头像左边的 + 按钮 , 在弹出的列表中 , 选择 " 新建项目 " 按钮 ;

选择创建空白项目 ;

在下面只需要输入项目名称即可 ;





二、将本地工程推送到 GitCode 远程仓库



这里按照推送现有文件夹的方案 , 推送文件夹 ;

cd existing_folder
git init
git remote add origin https://gitcode.net/han12020121/groovy_demo.git
git add .
git commit -m "Initial commit"
git push -u origin master

完整的执行流程 :

Microsoft Windows [版本 10.0.19043.1348]
(c) Microsoft Corporation。保留所有权利。

Y:\\002_WorkSpace\\003_IDEA\\Groovy_Demo>git init
Initialized empty Git repository in Y:/002_WorkSpace/003_IDEA/Groovy_Demo/.git/

Y:\\002_WorkSpace\\003_IDEA\\Groovy_Demo>git remote add origin https://gitcode.net/han12020121/groovy_demo.git

Y:\\002_WorkSpace\\003_IDEA\\Groovy_Demo>git add .
warning: LF will be replaced by CRLF in gradle/wrapper/gradle-wrapper.properties.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in gradlew.
The file will have its original line endings in your working directory

Y:\\002_WorkSpace\\003_IDEA\\Groovy_Demo>
Y:\\002_WorkSpace\\003_IDEA\\Groovy_Demo>git commit -m "Initial commit"
[master (root-commit) 0d26998] Initial commit
 21 files changed, 335 insertions(+)
 create mode 100644 .gradle/5.2.1/executionHistory/executionHistory.bin
 create mode 100644 .gradle/5.2.1/executionHistory/executionHistory.lock
 create mode 100644 .gradle/5.2.1/fileChanges/last-build.bin
 create mode 100644 .gradle/5.2.1/fileHashes/fileHashes.bin
 create mode 100644 .gradle/5.2.1/fileHashes/fileHashes.lock
 create mode 100644 .gradle/5.2.1/gc.properties
 create mode 100644 .gradle/buildOutputCleanup/buildOutputCleanup.lock
 create mode 100644 .gradle/buildOutputCleanup/cache.properties
 create mode 100644 .gradle/buildOutputCleanup/outputFiles.bin
 create mode 100644 .gradle/vcs-1/gc.properties
 create mode 100644 .idea/.gitignore
 create mode 100644 .idea/gradle.xml
 create mode 100644 .idea/jarRepositories.xml
 create mode 100644 .idea/misc.xml
 create mode 100644 .idea/vcs.xml
 create mode 100644 build.gradle
 create mode 100644 gradle/wrapper/gradle-wrapper.jar
 create mode 100644 gradle/wrapper/gradle-wrapper.properties
 create mode 100644 gradlew
 create mode 100644 gradlew.bat
 create mode 100644 settings.gradle

Y:\\002_WorkSpace\\003_IDEA\\Groovy_Demo>
Y:\\002_WorkSpace\\003_IDEA\\Groovy_Demo>git push -u origin master
info: detecting host provider for 'https://gitcode.net/'...
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcmcore-tlsverify for more information.
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcmcore-tlsverify for more information.
info: detecting host provider for 'https://gitcode.net/'...
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcmcore-tlsverify for more information.
Enumerating objects: 32, done.
Counting objects: 100% (32/32), done.
Delta compression using up to 12 threads
Compressing objects: 100% (22/22), done.
Writing objects: 100% (32/32), 55.33 KiB | 3.25 MiB/s, done.
Total 32 (delta 2), reused 0 (delta 0), pack-reused 0
remote:
remote: ========================================================================
remote:
remote:                        [codechina.csdn.net 域名
remote: 1222日停用公告](https://gitcode.net/gitcode/help-docs/-/issues/1)
remote:
remote: ========================================================================
remote:
To https://gitcode.net/han12020121/groovy_demo.git
 * [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

Y:\\002_WorkSpace\\003_IDEA\\Groovy_Demo>

提交的代码如下 :





三、验证权限



其中有个步骤需要输入账号密码 , 这里的账号是 CSDN 用户账号 , 密码是 个人访问令牌 , 参考 【Git】Git 分支管理 ( 解决分支合并冲突 | 推送主版本和分支版本到远程仓库 | 合并分支出现文件冲突 ) 一、推送主版本和分支版本到远程仓库 博客章节 ;

点击右侧头像 , 然后选择 " 设置 " , 在设置界面的 " 访问令牌 " 可以生成 " 个人访问令牌 " , 此处生成的 个人访问令牌 可以作为上面的 GitCode 提交代码时的密码使用 ;

以上是关于GitIntelliJ IDEA 提交代码到 GitCode 远程仓库 ( GitCode 创建远程仓库 | 将本地工程推送到 GitCode 远程仓库 | 验证权限 | 生成个人访问令牌 )(代码片的主要内容,如果未能解决你的问题,请参考以下文章

在IDEA中实战Git

利用idea将本地代码提交到git

idea中项目如何提交代码到svn上

idea本地代码未提交,更新后本地被删除了

git:IDEA与git(IDEA提交代码到本地仓库&远程仓库远程仓库克隆代码分支)

idea 提交代码到GitHub