一次从Github向Gitee迁库踩坑记录

先上结论:gitee的lfs功能收费,直接从github迁移包含lfs管理的文件会出错,配置lfs.url即可解决问题

Q: 为什么要迁库呢?
A: github访问太慢了,不然我也不想费这个功夫!

gitee自带的有从github同步仓库的功能,一般来说该功能非常方便。
然而,我们的github库使用了lfs,这就是踩坑的开始。

1.跟往常一样,直接在gitee中一键导入github仓库,一切正常。我还专门新建了一个文本文件测试了一下,上传成功,以为万事大吉了。
2.过了几个小时,一位成员突然给我说clone库的时候出错了,我一脸懵逼,Error downloading object Smudge error: Error downloading这是啥错?我没问题啊!

3.我自己clone了一下,发现报了一样的错误。在网上搜了半天发现貌似是二进制文件下载出了问题,在stackoverflow中找到了答案(在这吐槽一下,百度半小时,谷歌一分钟)

In my case the SSH-authenticated repository was updated to use LFS from another client and on my side Git-LFS didn't know about the SSH remote-url.
What I did to fix it was the following:
Copy the URL configured in remote.origin.url (push URL for origin) to lfs.url (the URL LFS uses):
$ git config lfs.url $(git config remote.origin.url)
(If your remote is not named origin then change to your remote name.)
Then run
$ git config lfs.url
to show the URL and confirm that it does indeed contain an SSH url, and not some HTTP/HTTPS url.
Then you can
$ git pull
Done.
See also: https://github.com/git-lfs/git-lfs/issues/2661#issuecomment-335903332

简单来说就是git找不到lfs文件的位置,我去gitee上一看,果然那些大文件都是not found,然后配置一下lfs.url即可

git config lfs.url https://github.com/xxxxx.git
4.配置完成后,我重新clone了一下,很好,没有报错,二进制文件也下载了。
5.然而我想上传一个大文件时,报了一个更离谱的错误ERROR: Authentication error: Authentication required: Authorization error:
没有权限?我是仓库管理员啊!

查询后发现,这不是git权限报错,而是git lfs没有权限,我这才想起来去看看gitee支不支持lfs,结果如下:

至此,破案了,lfs功能收费,我先发个邮件去问问,后续再更......

不对,该问题是由git lfs功能引起的,在github中也有不少人遇到

$ rm .git/hooks/pre-push
$ git push

可以解决没有授权的问题
感觉目前是这样:lfs是另外的库由github保管,其他没有被lfs track的文件可以上传到gitee,配置lfs.url后大文件还是放在github
不需要gitee的付费功能/hh

posted @ 2020-02-18 12:33  AlexEz  阅读(2249)  评论(0编辑  收藏  举报