idea 创建项目并同步到git仓库

一,先在git上创建一个项目

注意选择一个前缀,默认用户名

 

二,在本地创建项目

创建后,是没有git更新,push按钮的,因为没有关联到git

用命令:git init,这时项目文件变成红色了

三,本地项目关联到git仓库

创建git仓库,把本地项目与git远程仓库关联,Create Git Repository,下图没截准。

如果用命令: git remote add origin url

四,push项目到远程仓库

add,commit, push

从git上copy创建项目地址,就可以成功提交了

命令操作完成流程

git init

git add.

git commit -m 备注

git push -u origin master

遇到问题

1.fatal: refusing to merge unrelated histories

fatal: refusing to merge unrelated histories解决_天骄山仔的博客-CSDN博客

2.git创建完成之后,项目为空,没有git地址

在readme提交点什么

3.

4.Git:clone项目到本地之后报错->fatal: branch ‘master‘ does not exist

No tracked branch configured for branch master or the branch doesn‘t exist.

问题:使用clone拉取项目代码之后进行pull操作时提示关联,但关联的时候提示没有master->fatal: branch ‘master’ does not exist。
解决步骤:
1.git pull origin master --allow-unrelated-histories

2.git branch --set-upstream-to=origin/master master

4.解决方式同上

 

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值