美文网首页
github更新文件

github更新文件

作者: 0error_ | 来源:发表于2020-10-20 15:22 被阅读0次

克隆仓库到本地

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 分支名称

相关文章

网友评论

      本文标题:github更新文件

      本文链接:https://www.haomeiwen.com/subject/tfedmktx.html