GithubHelp home page GithubHelp logo

Comments (5)

Yikun avatar Yikun commented on September 15, 2024 2

@yi-Xu-0100 在Python分支里面,已经解决了这个问题,如果更新失败则会删除旧代码,重新clone一份:

try:
local_repo.git.pull(kill_after_timeout=self.timeout)
except git.exc.GitCommandError:
# Cleanup local repo and re-clone
print('Updating failed, re-clone %s' % self.name)
shutil.rmtree(local_repo.working_dir)
self._clone()

可以使用:uses: Yikun/hub-mirror-action@python试试,后续stable后也会merge主干分支。See more in #90

from hub-mirror-action.

yi-Xu-0100 avatar yi-Xu-0100 commented on September 15, 2024

我发现似乎是这个拉取出现问题,而不是同步出现问题。

function update_repo
{
echo -e "\033[31m(1/3)\033[0m" "Updating..."
retry git pull -p
}

这里的拉取应该是因为本地的 cache 分支是 master,造成无法删除当前的分支,然后无法拉取成功。

from hub-mirror-action.

Yikun avatar Yikun commented on September 15, 2024

@yi-Xu-0100 哈哈,你又踩坑了,这问题我也遇到过类似的。

这个问题的本质是cache的数据有问题(比如分支变化,无法自动merge;再比如你这个情况)导致的,规避方法是换下cache的key。

其实,在push的时候,当时也有类似的问题。但是,可以通过force update解决。

但这个pull,目前git是没有(或者是我不知道)git pull -f之类的指令的,所以可能的解决方案是:

方案一:在git pull失败的时候,通过reset之类的把本地的错误修改回退。
方案二:在git pull失败的时候,干掉文件夹,重新clone一份

即保证本地cache纯净后,再进行同步。

from hub-mirror-action.

yi-Xu-0100 avatar yi-Xu-0100 commented on September 15, 2024

@Yikun

git clone --reference[-if-able] 

刚查了下,使用方案二感觉会好些,可以用上面的参数,应该还能利用一下 cache 的数据。具体能利用多少就不知道了,但我想能够对大仓库还是能够提高下载速率的。

方案一的话,感觉并不是需要同步的时候考虑,当然仅是在强制同步的情况下。
非强制同步的情况下,还是给出 error 的好点。

from hub-mirror-action.

yi-Xu-0100 avatar yi-Xu-0100 commented on September 15, 2024

我使用了简单的解决办法。我删除 cache 中的错误的对应仓库的文件夹,使用这个步骤在备份的步骤之后。

- name: delete block_list cache directory
  run: |
    rm -rf ${{ github.workspace }}/hub-mirror-cache/Learn-for-coding/

注意事项:

  1. 此时需要将这个仓库加入 black_list 。在完成后,再重新将这个仓库移除 black_list
  2. 注意此时的 cache_path 应该为 /github/workspace/hub-mirror-cache

步骤有点繁琐,但可以在出现问题的时候,通过两次提交来完成修复这个这个同步问题,而不需要添加单独的同步文件来对该仓库处理。


方案二:在git pull失败的时候,干掉文件夹,重新clone一份 见 #78 (comment)

发现这个方式,其实就是 Yikun 提到的第二种解决办法。

from hub-mirror-action.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.