Method to override the .git folder

homer6
PRO

19 days ago

I understand that the policy is to not clone the .git folder by default.

But, I'd like to use git submodules inside the dockerfile.

How can I override this setting or work around it for this repo?

Solved

2 Replies

18 days ago

Unfortunately, we do not have support for get submodules at this time. Usually the community recommends using GH Actions as a way to set the build context like so:

```
name: "Pull submodule / Push to deploy branch"

on:

push:

branches: - main

jobs:

pull_submodule_and_deploy:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v3

with:

submodules: true

- name: Update commit author

run: |

git config user.name 'github-actions[bot]'

git config user.email 'github-actions[bot]@users.noreply.github.com'

- name: Push to deploy branch

run: |

git checkout -b deploy

git rm --cached path/to/your/submodule

git rm .gitmodules

rm -rf path/to/your/submodule/.git

git add path/to/your/submodule

git commit -m "Flatten submodule for Railway deployment"

git push origin deploy -f
```

This should likely get you off the ground.


Status changed to Awaiting User Response railway[bot] 18 days ago


homer6
PRO

14 days ago

Excellent. Thank you for the workaround.


Status changed to Awaiting Railway Response railway[bot] 14 days ago


Status changed to Solved brody 14 days ago