GitHub和IDEA的配合使用 | Github获取token
发布时间:2023年12月29日
GitHub和IDEA的配合使用
在我们使用idea这类JetBrains公司的IDE连接github方便上传代码的时,我们如果是第一次使用,经常会陷入许多bug,在网上直接搜教程也没有具体能解决的;下面,我将系统带大家来在idea上连接github(其他代码管理平台也同理)
idea中链接github
- 点击settings设置

- 找到github(找不到可以直接搜索)

- 点击左上角加号,点击Log In with Token

- 去github生成token


- 点击Personal access tokens(个人访问令牌)





将生成的令牌拷贝下来(不要拷贝我的,拷贝你自己生成的!),切记切记自己**保存**
,下次你再打开就看不到了。
- 输入Token,点击Add Account即可连接上

- 添加成功

上传
好,连接好后,我们就可以上传我们的代码啦!
- 点击导航条VCS(版本控制系统)

- 点击 Create Git Respository,创建git仓库

- 点击后,导航条就会出现下面图标

- 点击对勾,提交commit项目到本地仓库

- 点击后出现一下界面,在左侧选择要提交的项目(要提交的就勾选),在commit message部分写本次提交的注释(说明本次项目修改了什么等等)

- 点击提交commit,出现以下页面,点击Define remote设置路径

- 这是路径时,需要先看好它的主分支是什么,否则就会自动创建分支,导致没有推送到主分支。
idea默认推送分支是master,但github在2021年改版后,将主分支默认设置为了main,所以我们需要现将github中的主分支修改为master
- 方式一:修改所有仓库默认分支为master,然后重新建立一个项目,这时它的主分支就是master


- 点击url设置github中的仓库路径
- 路径获取:打开github仓库,点击Code,然后就会出现以下界面,将https://github.com/…/…复制


好啦,github与idea的纠缠就到这里啦,如果大家觉得写的还不错的话,可不可以给我一个小小的赞,我们下期在见!
文章来源:https://blog.csdn.net/m0_61780691/article/details/135185326
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:chenni525@qq.com进行投诉反馈,一经查实,立即删除!