您的位置:首页 > 健康 > 美食 > [git操作] git创建仓库上传github报错

[git操作] git创建仓库上传github报错

2024/10/5 17:21:29 来源:https://blog.csdn.net/weixin_51552032/article/details/141338267  浏览:    关键词:[git操作] git创建仓库上传github报错

操作流程如下

  1. 使用 git init
  2. 使用 git remote add origin 项目ssh链接
  3. git add .

报错如下

Bus error (core dumped)

然后执行任何别的操作都会报错:

fatal: Unable to create 'path .. /.git/index.lock': File exists.Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.

输入git status 查看,之前的add操作确实没有成功:

On branch masterNo commits yetUntracked files:(use "git add <file>..." to include in what will be committed)Checkpoints/Code/Data/Misc/Results/Scripts/nothing added to commit but untracked files present (use "git add" to track)

按照它的提示,把 .git/index.lock 文件手动删掉,然后重新 git add . 就可以了。

修改本地master成为main

  • 参考:https://blog.csdn.net/jiahongfei1213895/article/details/128661543
git branch -m master main

然后拉取remote的仓库

git pull origin main

如果是新建仓库,可能会报错:efusing to merge unrelated histories这通常是因为本地分支上的代码和远程分支上的代码没有共同祖先,也就是说他们之间没有关联。要强制合并两个不相关的历史记录:

git pull origin main --allow-unrelated-histories

pull之后merge,merge之后commit修改

git commit -m  "your commit message"

push的方式

git push --set-upstream origin main # 如果第一次git push失败了,可以这么干

git限制了100MB的大小

所以注意要在 .gitignore 文件处设置好,不要上传大的文件

比如深度学习模型实验中需要忽略的文件,注意不要多加 ./ ,比如 ./Data/* 它还是会上传 Data 的!!!

# data files can't upload
**/__pycache__
Data/NpyData
Data/cuda_normalizers
Data/vahadane_images
Checkpoints
Results
wandb
Code/models/backbones/pretrained_weight

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com