Git之删除远程仓库上的文件

报错解决:

$ git push origin master
To http://stash.lab.tclclouds.com/scm/sec/cloud_music_config_admin.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to ‘http://quincycui@stash.lab.tclclouds.com/scm/sec/cloud_music_config_admin.git
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., ‘git pull …’) before pushing again.
hint: See the ‘Note about fast-forwards’ in ‘git push –help’ for details.

解决:$ git push -f origin master

Password for ‘http://quincycui@stash.com‘:
To http://quincycui@stash.git
! [rejected] master -> master (fetch first)
error: 无法推送一些引用到 ‘http://quincycui@stash.lab.tclclouds.com/scm/sec/cloud_music_config_admin.git
提示:更新被拒绝,因为远程仓库包含您本地尚不存在的提交。这通常是因为另外
提示:一个仓库已向该引用进行了推送。再次推送前,您可能需要先整合远程变更
提示:(如 ‘git pull …’)。
提示:详见 ‘git push –help’ 中的 ‘Note about fast-forwards’ 小节。

解决:git pull origin master

初始化本地仓库:

$ git config –global user.name “username”
$ git config –global user.email “quincycui@tcl.com”
$ git init
$ git add .
$ git commit -m ‘后台代码’
$ git remote add origin http://quincycui@stash.git
$ git push origin master

删除远程仓库上的文件直接上命令:

git rm – cached react-app/.idea #删除层级为第二层的文件夹
fatal: 未提供 -r 选项不会递归删除 ‘react-app-scaffold/.idea’
git rm -r –cached react-app/.idea
git commit -m ‘将误上传的idea文件夹删除’
git push origin master

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值