IDEA上传代码到gitee

需要条件:

1.码云/Github建好的git项目

2.IDEA编辑器

3.本地项目

 

步骤1:创建远程项目

 

步骤2:复制远程项目地址  注意:此处码云官方已经给出上传项目方法,不过用的是命令行的形式,我们选择一种更加简单的方法。

 

步骤3:创建好本地项目,点击VCS,按照图中指示给项目创建Git仓库。

 

步骤4:选择此项目的根目录作为仓库。

 

步骤5:选中项目名先将项目add到缓冲区,再commit到本地仓库。

 

这里放一张git的add和commit图解帮助大家理解为什么一个新的项目要先add再commit:

 

步骤6:点击Commit Directory后在弹出框中填写Commit Message(提交信息),然后选择Commit and Push。

 

步骤7:在弹出的Push Commits对话框中点击“Define  remote",填入步骤2中复制的远程项目地址。

 

步骤8:点击push。

 

步骤9:查看Version Control--》log

 

步骤10:上传成功!

 

下次更新代码直接:

在Terminal中输入命令

git add .

git commit -m "备注"

git pull

git push

--------------------- 本文来自 Jenrey 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/JENREY/article/details/80070243?utm_source=copy

 

补充:

    Push rejected: Push to origin/master was rejected 解决方案:

 

 

解决方案如下:

1.切换到自己项目所在的目录,右键选择GIT BASH Here,Idea中可使用Alt+F12

2.在terminl窗口中依次输入命令:

git pull

git pull origin master

git pull origin master --allow-unrelated-histories

3.在idea中重新push自己的项目,成功!!!

--------------------- 本文来自 奔跑的董儿 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/a137151062/article/details/78820806?utm_source=copy

 

 

补充:

idea中无法使用Terminal输入git bash指令:

1.如果你只是想使用git命令,只要在系统环境变量的path加上git设置就可以。

例如我的git安装路径是:D:\Program Files\Git

环境变量配置为:D:\Program Files\Git\cmd

 

 

 

2.如果你是想把gitbash替换掉idea的默认的终端(cmd),那么在idea上

settings--->tools--->Terminal中的shell path 填上 :D:\Program Files\Git\bin\bash.exe

 


重新打开终端即可。

--------------------- 本文来自 equalsdev 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/lJQueen/article/details/78686483?utm_source=copy

 

新建的分支进行push时候发生git:fatal the current branch master has no upstream branch

英文解决方案连接,感谢michaeltwofishGoZonerdunni

git本地仓库push远程仓库的时候,报了异常:fatal the current branch master has no upstream branch

但是按提示, git push --set-upstream ../remote-jackygit.git master 并没有解决问题。

经过查询发现目前有两种解决方案:

1.翻译后大致意思是,远程仓库创建时候要建立一个README文件,然后再进行push操作。因为这个文件是远程仓库主分支所必须的,见如下截图。

Create the repo on github; add a README file on github and then clone the github repository.  Creating the README file (or any file actually) is needed in order to get a master branch.Notice how github prompts for creating a README when creating a repository:

2.翻译后大致意思是,如果不想重新创建远程仓库再克隆(针对方案1),或者初始化本地仓库,可以使用下面命令: git push -u origin master,其中origin 表示远程仓库名称,master是远程仓库的push目标分支。-u (推测为update缩写^_^~)表示本地分支将建立对远程仓库目标分支的检测,如果远程仓库目标分支不存在,将新建分支再push;如果存在,将进行push更新。

Instead of creating a new repository on Github, cloning that, or reinitializing your local repository, the following command would have been sufficient:

git push -u origin master

origin stands for the remote name (default is origin), and master is the branch you want to push, in your case it's master, otherwise you would have to change that in the command.
-u means, that your local branch will be setup to track the new created master branch on the origin repository (the master on the origin will be the upstream branch of your local branch). If the branch master doesn't exist on the remote repository, it will be created, otherwise it will be updated (the -u works no matter if it exists or not).

然后,验证此方法,确实可行!

--------------------- 本文来自 qqb123456 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/qqb123456/article/details/25319659?utm_source=copy

 

 

 

 

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值