报错解决:

$ 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

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐