如何将IDEA文件提交至Gitee仓库

目录

Gitee

IDEA

创建本地仓库

连接远程仓库

提交


准备:拥有一个Gitee账户并已安装IDEA、Git

Gitee

1.登录Gitee,在页面右上角➕处新建一个仓库

2.仓库名可以任意填写,符合规则即可,然后点击“创建”

 3.创建好后,复制红框处的地址

IDEA

 4.打开IDEA,在菜单栏中选择Files→Settings

 5.搜索Git,如果git.exe路径未被添加,输入自己的Git安装目录下的git.exe的路径,如果已经自动识别,忽略此步骤

创建本地仓库

 6.点击VCS→lmport into Version Controly→Create Git Repository...创建自己的本地仓库

7.选择仓库创建路径并点击OK完成创建

连接远程仓库

8.随后需要这个仓库与Gitee仓库远端连接起来,点击VCS→Git→Remotes...

 9.在此处新建一个远端,输入之前在Gitee上复制的仓库地址

提交

 10.将需要提交的文件先提交到至本地仓库

11.点击VCS→Git→Push

 12.选择将其提交至Gitee仓库

13.打开你的Gitee仓库,刷新就可以看到你提交到远程仓库的所有文件啦!

2023年5月29日更新:

新建仓库,git push时遇到错误

To https://gitee.com/orlgoung/bit_forum.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/orlgoung/bit_forum.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

 参考git push后出现错误 ![rejected] master -> master(non-fast-forward) error:failed to push some refs to XXX_whoah的博客-CSDN博客

由于是新建的仓库,里面只有README.md文件,所以使用如下命令强制上传覆盖远程文件

git push -f origin master

第二次进行提交时,仍出现该问题,参考

git push报错:The current branch master has no upstream branch-阿里云开发者社区 (aliyun.com)

在git push时使用如下命令上传

git push --set-upstream origin master
  • 8
    点赞
  • 37
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值