github更新文件

克隆仓库到本地

git clone 这里写仓库地址

image.png

如果已经配置SSH key,克隆的时候仓库地址记得选SSH地址

更新文件

进入项目所在本地文件夹,右键-git bash here
git add . (全部文件)
git add filename (需要更新的文件名称)
git commit -m "提交信息"
git push -u origin main

如果报错: Updates were rejected because the remote contains work that you do hint: not have locally.
则需要先git pull,再push

https://blog.csdn.net/shizhenweiszw/article/details/87486195

报错:Your configuration specifies to merge with the ref 'refs/heads/master'

from the remote, but no such ref was fetched.

解决办法:
git init

报错:‘origin‘ does not appear to be a git repository

解决办法:
git remote add origin 这里写git仓库地址

报错: 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.
解决办法:
先pull再push:
git pull
会提示:Please enter a commit message to explain why this merge is necessary
解决办法:
可以直接下面3,4步退出黑框。如果要输入解释的话就需要1-4步:
1.按键盘字母 i 进入insert模式
2.修改最上面那行黄色合并信息,可以不修改
3.按键盘左上角"Esc"
4.输入":wq",注意是冒号+wq,按回车键即可
https://lijunde.blog.csdn.net/article/details/89047553?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-3.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-3.control

删除分支

git push origin --delete 分支名称

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容