(创建新仓库时,在该文件目录下执行以下命令行)
git init git config --global user.name "hyxxi" git config --global user.email "9443562+hyxxi@user.noreply.gitee.com" # git地址可修改 git remote add origin https://toscode.gitee.com/hyxxi/train.git # 之后一般需要填写登陆者id与密码
(后添加)把新添加的文件加入下载文件夹中 并cd进入文件夹
git add . # 双引号里填写新添加文件的介绍 第一次 first 第二次second git commit -m "first commit" ## 第一次上传不需要写 ## git pull --rebase origin master # 第一次执行指令后需要登陆自己的git账号 git push -u origin master
切换关联仓库
git remote rm origin git remote add origin https://toscode.gitee.com/hyxxi/train.git删除操作
# 删除关联仓库中的文件 git rm -r --cached 删除的文件名称 # 删除缓存区 git rm --cached +文件名 # 删除仓库及缓存区的文件 git rm --f +文件路名 #清空缓存区 rm .git/index相关问题
报错:error: src refspec master does not match any.
git commit -m "init" git remote add origin xxxxxxxx.git git push -u origin master
报错:! [rejected] master -> master (fetch first)
git pull --rebase origin master git push origin master
报错:warning: LF will be replaced by CRLF in VOCdevkit/VOC2012/ImageSets/Segmentation/val.txt.The file will have its original line endings in your working directory
删除.git路径下 index.lock 文件
在.git文件夹下打开config配置文件,添加上下面两句话:
autocrlf = false safecrlf = false大文件传输常见问题
报错:error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
方法:改用ssh进行传输
## 配置ssh # 执行命令后 需要敲3次回车 # 如果先前配过 overwrite即可 ssh-keygen –t rsa –C "9443562+hyxxi@user.noreply.gitee.com" //邮箱可改 # 查看公钥 把得到的公钥保存gitee的SSH公钥上 # 网址为 https://toscode.gitee.com/profile/sshkeys cat ~/.ssh/id-rsa.pub # 测试公钥 # 输入yes看到 successful 即完成,but后面不管 ssh -T git@gitee.com ## 利用ssh进行传输 # 只有下面这条指令要变 其余过程与指令均一致 git remote add origin git@toscode.gitee.com:hyxxi/cityscapes.git ##git地址 ssh版本 ## 把访问方式改为ssh方式 git remote set-url origin git@toscode.gitee.com:hyxxi/cityscapes.git
报错:error: File: 983ce1d6a8f43328d06d8337db7c62cfbf005ecf 1845.66 MB, exceeds 100.00 MB.
remote: error: File: 983ce1d6a8f43328d06d8337db7c62cfbf005ecf 1845.66 MB, exceeds 100.00 MB. remote: Use command below to see the filename: #这句里的两指令其实就是提示 删除大文件提交记录 remote: git rev-list --objects --all | grep 983ce1d6a8f43328d06d8337db7c62cfbf005ecf remote: Please remove the file from history and try again. (https://gitee.com/help/articles/4232) To toscode.gitee.com:hyxxi/cityscapes.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'toscode.gitee.com:hyxxi/cityscapes.git'
采用git lfs方法
#
git rev-list --objects --all | grep -E `git verify-pack -v .git/objects/pack/*.idx | sort -k 3 -n | tail -10 | awk '{print$1}' | sed ':a;N;$!ba;s/n/|/g'`
git filter-branch --tree-filter 'rm -f path/to/large/files' --tag-name-filter cat -- --all
git push origin --tags --force
git push origin --all --force
查看设置关联仓库网址
git remote -v



