操作流程如下
- 使用
git init
- 使用
git remote add origin 项目ssh链接
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