正文
###如何在Github中删除Github中的某个文件或文件夹
1.本地仓库的文件和远程仓库的文件同时删除
先打开本地仓库的文件夹,选择要删除的文件或者文件夹点击删除,注意git仓库不要删除。
然后在执行下面的命令行即可。刷新页面后在看下远程仓库的文件或者文件夹就已经被删除了。
cd Padavan
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git add *
#将所有文件暂存
git commit -m 'del'
#将所有文件提交本地
git push -u origin master
#将所有文件提交远程
###GIT推送错误
- GIT推送错误error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
Counting objects: 100% (25515/25515), done.
Delta compression using up to 4 threads
Compressing objects: 100% (18794/18794), done.
error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
fatal: the remote end hung up unexpectedlyiB | 19.00 KiB/s
Writing objects: 100% (25503/25503), 28.46 MiB | 298.00 KiB/s, done.
Total 25503 (delta 5409), reused 25463 (delta 5393), pack-reused 0
fatal: the remote end hung up unexpectedly
Everything up-to-date
增加git缓冲区大小
git config --global http.postBuffer 524288000
解决github此分支存在必须解决的冲突
拉取源
git clone --depth=1 https://github.com/yuos-bit/lede
#拉取最新源
cd lede
#进入操作目录
git config --global user.email "864529498@qq.com"
#设置邮箱
git config --global user.name "yuos-bit"
#设置用户名
# 1. 查看本地仓库设置的远端仓库,是否有连接上游原始远端仓库
如果未连接上游仓库,添加远程仓库的变量地址
git remote -v
origin https://github.com/yuos-bit/lede (fetch)
origin https://github.com/yuos-bit/lede (push)
#添加上游仓库
git remote add upsteream https://github.com/coolsnowwolf/lede.git
#fetch,取回原仓库的更新
git fetch upsteream
remote: Enumerating objects: 100886, done.
remote: Counting objects: 100% (100884/100884), done.
remote: Compressing objects: 100% (37168/37168), done.
remote: Total 96095 (delta 55451), reused 91452 (delta 51109), pack-reused 0
Receiving objects: 100% (96095/96095), 225.08 MiB | 589.00 KiB/s, done.
Resolving deltas: 100% (55451/55451), completed with 3074 local objects.
From https://github.com/coolsnowwolf/lede
* [new branch] master -> upsteream/master
* [new tag] 20200408 -> 20200408
* [new tag] 20200416 -> 20200416
* [new tag] 20200915 -> 20200915
* [new tag] 20211107 -> 20211107
* [new tag] 20220505 -> 20220505
* [new tag] 20220716 -> 20220716
常用命令
git branch
#查看分支1
git branch -a
#查看所有分支
git branch -av
#查看分支2
git branch main
#新建一个分支 main
git checkout main
#切换分支 main
git checkout -b <name>
#或者创建切换这个<name>分支
git branch -d localBranchName
//删除本地分支
git push -d origin branch_name
git branch -d branch_name
//删除远程分支
git remote -v
//查看git对应的远程仓库地址
git remote rm origin
//删除关联对应的远程仓库地址
git remote -v
//查看是否删除成功,如果没有任何返回结果,表示OK
git remote add origin https://github.com/developers-youcong/Metronic_Template.git
//重新关联git远程仓库地址
git branch -m oldBranchName newBranchName
//重命名本地仓库
记录一次github合并分支
使用github桌面版拉取源码
然后运行以下命令
git checkout main
# 切换到主分支
git merge master
# 合并master 到main分支
git status
# 定位冲突文件
git add *
#将所有文件暂存
git commit -m 'update 2022.12.08'
#将所有文件提交本地
git push -u origin main
#将所有文件提交远程
完成更新
记录一次github报错
报错信息
! [rejected] main -> main (fetch first)
error: failed to push some refs to 'https://github.com/yuos-bit/openwrt-19.07.git'
解决办法
git push origin master --force
````