欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

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

发布时间:2025/6/17 编程问答 49 豆豆

文章目录

  • 前言
  • 一、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.gitY:\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 directoryY:\002_WorkSpace\003_IDEA\Groovy_Demo> Y:\002_WorkSpace\003_IDEA\Groovy_Demo>git commit -m "Initial commit" [master (root-commit) 0d26998] Initial commit21 files changed, 335 insertions(+)create mode 100644 .gradle/5.2.1/executionHistory/executionHistory.bincreate mode 100644 .gradle/5.2.1/executionHistory/executionHistory.lockcreate mode 100644 .gradle/5.2.1/fileChanges/last-build.bincreate mode 100644 .gradle/5.2.1/fileHashes/fileHashes.bincreate mode 100644 .gradle/5.2.1/fileHashes/fileHashes.lockcreate mode 100644 .gradle/5.2.1/gc.propertiescreate mode 100644 .gradle/buildOutputCleanup/buildOutputCleanup.lockcreate mode 100644 .gradle/buildOutputCleanup/cache.propertiescreate mode 100644 .gradle/buildOutputCleanup/outputFiles.bincreate mode 100644 .gradle/vcs-1/gc.propertiescreate mode 100644 .idea/.gitignorecreate mode 100644 .idea/gradle.xmlcreate mode 100644 .idea/jarRepositories.xmlcreate mode 100644 .idea/misc.xmlcreate mode 100644 .idea/vcs.xmlcreate mode 100644 build.gradlecreate mode 100644 gradle/wrapper/gradle-wrapper.jarcreate mode 100644 gradle/wrapper/gradle-wrapper.propertiescreate mode 100644 gradlewcreate mode 100644 gradlew.batcreate mode 100644 settings.gradleY:\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 提交代码时的密码使用 ;

总结

以上是生活随笔为你收集整理的【Git】IntelliJ IDEA 提交代码到 GitCode 远程仓库 ( GitCode 创建远程仓库 | 将本地工程推送到 GitCode 远程仓库 | 验证权限 | 生成个人访问令牌 )的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。