Cannot push to submodule repo

Describe

I can push to the repository the codespace belongs to normally, but cannot push to the
repository of submodule.

Step to reproduce

In case I have a codespace launched from sarisia-org/baserepo and sarisia-org/baserepo has
a submodule of the repository sarisia-org/submod checked out to submod directory.

  1. move to submod directory.
$ cd submod
  1. leave detatched HEAD by checking out master branch
$ git checkout master
  1. do something, then commit
$ touch testfile
$ git add testfile
$ git commit -m "add testfile"
  1. push fails
$ git push
remote: Permission to sarisia-org/submod.git denied to sarisia.
fatal: unable to access 'https://github.com/sarisia-org/submod.git/': The requested URL returned error: 403

P.S.

I think I can do workaround by setting credential.helper=store and provide my personal access
token to git, but doing this every time creating the codespace is really painful, so it’s wonderful
if I can use the credential provided by default to push to submodules.

1 Like