0

I have meta repo, named anecdotes which has two submodules - utils & global-sync. global sync has also utils submodule in it. In anecdotes repo there is .gitmodules file, with this content:

[submodule "globals-sync"]
    path = globals-sync
    url = https://github.com/organization/globals-sync.git
    branch = master
[submodule "utils"]
    path = utils
    url = https://github.com/organization/utils.git
    branch = master

global sync .gitmodules file content is:

[submodule "utils"]
        path = utils
        url = https://github.com/organization/utils.git

default branch for utils repo is develop and default branch for global-sync repo is master (the global-sync repo contains, as I said, utils submodule).

git version is 2.30

And now - describing the issue: In github actions, trying to deploy from anecdotes repo. First I checkout to anecdotes repo - by doing so, the action checking out repo and the submodules (fetching & cloning it) at this point - the global-sync & utils repo checked out properly (means - as it's being committed in anecdotes repo)

Now, I want to update submodules to latest commits (in the remote)So I run:

git submodule update --remote

Which immediately failed with the following error:

fatal: Needed a single revision
Unable to find current origin/master revision in submodule path 'utils'

After reading a lot of similar problems I could isolated the problem:: here

By cd to utils directory and get info about the repo, I saw that "master" branch is not exist: "git branch -a" listed only develop branch

any ideas?

  • I deleted the utils directory in anecdotes and cloned it - the problem still occures.
  • Tried to do update submodules locally - successfully.
Paz Bechor
  • 19
  • 5
  • If by "git actions" you mean "gitHUB actions", probably they're using shallow-and/or-single-branch clones for their submodules. Make sure they don't do that (by whatever configuration items they provide that default to doing that). – torek Mar 03 '21 at 21:33
  • 1
    Please don't edit-in an answer to your question. You can post a complete answer to your own question instead below. Also, as asked before, please make sure to use the correct terminology. Git and GitHub are different things, offering different functionality (with sometimes colliding names) – Holger Just Mar 04 '21 at 09:27

1 Answers1

0

The problem was I didn't set fetch-depth in the yaml file explictly. default fetch-depth is 1, only need to add it with 0 value (means all) and then I was able to see al the branches. uses: actions/checkout@v2 with: token: ${{ secrets.GITHUB }} submodules: 'recursive

Paz Bechor
  • 19
  • 5