admin管理员组文章数量:1648539
文章目录
- 1. github上上传文件夹
- 2. '<filename>' does not have a commit checked out
- 3. this exceeds GitHub's file size limit of 100.00 MB
- 4. error: src refspec master does not match any
1. github上上传文件夹
首先在github上create a new repository,填写repository name,根据需求选择public、private,勾选 Add a README file,最后确认
在本地文件夹里创建一个新的文件夹,进入这个新文件,再输入git init
mkdir xxx
cd xxx
git init
找到自己的repository,复制自己的repository(可以使用ssh进行clone,就不会出现fatal: unable to access ‘https://github/…/.git‘: Recv failure Connection was rese了,https://blog.csdn/m0_72594605/article/details/132559545)
输入
git clone xxxx
把要上传的文件移入这个git clone
的文件夹里,进入这个文件夹,输入
cd xxx
git add .
再输入git commit -m "first commit"
,双引号里面是写入备注,以方便后面在github上面能看到上传记录,根据这个备注得知做了什么修改
git commit -m "first commit"
最后
git push origin main
2. ‘’ does not have a commit checked out
原因参考https://stackoverflow/questions/56873278/how-to-fix-error-filename-does-not-have-a-commit-checked-out-fatal-adding
出现这种问题是因为你准备git add
这个文件夹的时候,在你上传的这个文件夹里面有一个子目录有.git
目录
上面会提示你那个文件夹里有.git
,首先用git reset .
取消之前git add .
的所有文件
git add
再进入那个文件夹,用ls -la
就可以查看所有文件,
ls -la
包括隐藏文件.git
,若显示了有.git
文件,用rm -fr .git
删除即可
rm -fr .git
3. this exceeds GitHub’s file size limit of 100.00 MB
主要是因为文件过大,下载git lfs即可
https://docs.github/zh/repositories/working-with-files/managing-large-files/installing-git-large-file-storage
我的大文件是心理学与生活…,根据对应的大文件名修改即可,在输入commit的备注信息,最后根据是main
还是master
进行push,我这里是main,因此输入git push origin main
git lfs track 心理学与生活第19版中文版.pdf
git add 心理学与生活第19版中文版.pdf
git commit -m "add bigfile-心理学与生活第19版中文版.pdf"
git push origin main
我在输入这些命令时发现了以下报错
batch response: This repository is over its data quota. Account responsible for LFS bandwidth should purchase more data packs to restore access.
此处参考https://stackoverflow/questions/62905325/this-repository-is-over-its-data-quota-account-responsible-for-lfs-bandwidth-sh
因此还需要在github上的repository进行设置,(我设置了还是没解决,这个后面再说)
- Fork the repo to one of your users
- Go to repo settings
- Find “Include Git LFS objects in archives” under the Archives section and check it
- Go to the Danger Zone section, select “Archive this repository”
- Confirm and authorize.
- Return to the archived repository. 7 .Download as .zip
- Download will pause for a minute or so before it starts downloading lfs objects. Wait and it should continue.
4. error: src refspec master does not match any
参考https://blog.csdn/qq_43142509/article/details/124182138
现在github的默认分支为main,而我输入的命令是git push origin master
,需要提交到main,而不是master,将master
改成main
即可
git push origin master
版权声明:本文标题:github上传文件及其问题解决 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1729493351a1202658.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论