Search code examples
gitignorerailway

Does RailwayCLI ignore files defined in .gitignore?


The command railway up takes your current local project and uploads it directly to railway without having to link a Github repo to your railway project.

Does RailwayCLI take into account .gitignore file like Git does? if not what is the proper way to ignore files (not upload them) when using the command.

I couldn't find anything relevant mentioned in their docs.


Solution

  • No, RailwayCLI does not take into account the .gitignore file. If you want to ignore certain files when using the railway up command, you can use the --ignore-files flag. For example, to ignore all files with the .txt extension, you would use the following command:

    railway up --ignore-files .txt
    

    Update:

    The -ignore-files flag uses the same globbing patterns as .gitignore. So you can use the * character to match any number of characters, and the ? character to match any single character.

    For example, the following command will ignore all files that start with the word "app" and have any extension:

    railway up --ignore-files app*
    

    This command will ignore all files that have the .txt or .json extensions:

    railway up --ignore-files .txt,.json
    

    This command will ignore all files in the ./test directory and its subdirectories:

    railway up --ignore-files ./test/*
    

    You can also use the -ignore-files option to ignore specific files, even if they have extensions that are not listed in the .gitignore file. For example, the following command will ignore the file app.txt, even though the .txt extension is not listed in the .gitignore file:

    railway up --ignore-files app.txt