diff --git a/pre_commit_hooks/detect_aws_credentials.py b/pre_commit_hooks/detect_aws_credentials.py
index b0826ca..42758f0 100644
--- a/pre_commit_hooks/detect_aws_credentials.py
+++ b/pre_commit_hooks/detect_aws_credentials.py
@@ -95,6 +95,12 @@ def main(argv=None):
             'secret keys from'
         )
     )
+    parser.add_argument(
+        '--allow-missing-credentials',
+        dest='allow_missing_credentials',
+        action='store_true',
+        help='Allow hook to pass when no credentials are detected.'
+    )
     args = parser.parse_args(argv)
 
     credential_files = set(args.credential_files)
@@ -111,6 +117,9 @@ def main(argv=None):
     # the set of keys.
     keys |= get_aws_secrets_from_env()
 
+    if not keys and args.allow_missing_credentials:
+        return 0
+
     if not keys:
         print(
             'No AWS keys were found in the configured credential files and '

detect-aws-credentials fails when no credentials are set
As part of our developer setup, each person installs the pre-commit and inherits the project's hooks, but not everyone has aws credentials set up, so `detect-aws-credentials` will product a failure when the individual hasn't set any keys file or has any exported to their env.

https://github.com/pre-commit/pre-commit-hooks/blob/20f04626a1ee7eb34955d775a37aa9a56a0a7448/pre_commit_hooks/detect_aws_credentials.py#L112

I'm not sure of the best way to handle this within the current logic - I'd rather exit 0 with a passing warning than fail, since this then forces the individual to go and set up a credentials file, even if they don't use one.

I guess the "simple" workaround is to `export AWS_SECRET_ACCESS_KEY="RANDOMSTRINGTHATNEVERTEXISTSINMYCODE!!"` before running the pre-commit hooks, but this seems wrong.
diff --git a/tests/detect_aws_credentials_test.py b/tests/detect_aws_credentials_test.py
index 9c2fda7..943a3f8 100644
--- a/tests/detect_aws_credentials_test.py
+++ b/tests/detect_aws_credentials_test.py
@@ -130,3 +130,17 @@ def test_non_existent_credentials(mock_secrets_env, mock_secrets_file, capsys):
         'and environment variables.\nPlease ensure you have the '
         'correct setting for --credentials-file\n'
     )
+
+
+@patch('pre_commit_hooks.detect_aws_credentials.get_aws_secrets_from_file')
+@patch('pre_commit_hooks.detect_aws_credentials.get_aws_secrets_from_env')
+def test_non_existent_credentials_with_allow_flag(mock_secrets_env, mock_secrets_file):
+    """Test behavior with no configured AWS secrets and flag to allow when missing."""
+    mock_secrets_env.return_value = set()
+    mock_secrets_file.return_value = set()
+    ret = main((
+        get_resource_path('aws_config_without_secrets.ini'),
+        "--credentials-file=testing/resources/credentailsfilethatdoesntexist",
+        "--allow-missing-credentials"
+    ))
+    assert ret == 0

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio pre-commit pytest
3.6
requirements-dev.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
autopep8==2.0.4
certifi==2021.5.30
cfgv==3.3.1
coverage==6.2
distlib==0.3.9
execnet==1.9.0
filelock==3.4.1
flake8==2.5.5
identify==2.4.4
importlib-metadata==4.2.0
importlib-resources==5.2.3
iniconfig==1.1.1
mccabe==0.4.0
mock==5.2.0
nodeenv==1.6.0
packaging==21.3
pep8==1.7.1
platformdirs==2.4.0
pluggy==1.0.0
pre-commit==2.17.0
-e git+https://github.com/pre-commit/pre-commit-hooks.git@20f04626a1ee7eb34955d775a37aa9a56a0a7448#egg=pre_commit_hooks
py==1.11.0
pycodestyle==2.10.0
pyflakes==1.0.0
pyparsing==3.1.4
pytest==7.0.1
pytest-asyncio==0.16.0
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
PyYAML==6.0.1
simplejson==3.20.1
six==1.17.0
toml==0.10.2
tomli==1.2.3
typing_extensions==4.1.1
virtualenv==20.16.2
zipp==3.6.0

name: pre-commit-hooks
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - autopep8==2.0.4
      - cfgv==3.3.1
      - coverage==6.2
      - distlib==0.3.9
      - execnet==1.9.0
      - filelock==3.4.1
      - flake8==2.5.5
      - identify==2.4.4
      - importlib-metadata==4.2.0
      - importlib-resources==5.2.3
      - iniconfig==1.1.1
      - mccabe==0.4.0
      - mock==5.2.0
      - nodeenv==1.6.0
      - packaging==21.3
      - pep8==1.7.1
      - platformdirs==2.4.0
      - pluggy==1.0.0
      - pre-commit==2.17.0
      - py==1.11.0
      - pycodestyle==2.10.0
      - pyflakes==1.0.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytest-asyncio==0.16.0
      - pytest-cov==4.0.0
      - pytest-mock==3.6.1
      - pytest-xdist==3.0.2
      - pyyaml==6.0.1
      - simplejson==3.20.1
      - six==1.17.0
      - toml==0.10.2
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - virtualenv==20.16.2
      - zipp==3.6.0
prefix: /opt/conda/envs/pre-commit-hooks

tests/detect_aws_credentials_test.py::test_non_existent_credentials_with_allow_flag
tests/detect_aws_credentials_test.py::test_get_aws_credentials_file_from_env[env_vars0-values0] tests/detect_aws_credentials_test.py::test_get_aws_credentials_file_from_env[env_vars1-values1] tests/detect_aws_credentials_test.py::test_get_aws_credentials_file_from_env[env_vars2-values2] tests/detect_aws_credentials_test.py::test_get_aws_credentials_file_from_env[env_vars3-values3] tests/detect_aws_credentials_test.py::test_get_aws_credentials_file_from_env[env_vars4-values4] tests/detect_aws_credentials_test.py::test_get_aws_credentials_file_from_env[env_vars5-values5] tests/detect_aws_credentials_test.py::test_get_aws_credentials_file_from_env[env_vars6-values6] tests/detect_aws_credentials_test.py::test_get_aws_credentials_file_from_env[env_vars7-values7] tests/detect_aws_credentials_test.py::test_get_aws_credentials_file_from_env[env_vars8-values8] tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_env[env_vars0-values0] tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_env[env_vars1-values1] tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_env[env_vars2-values2] tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_env[env_vars3-values3] tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_env[env_vars4-values4] tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_env[env_vars5-values5] tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_env[env_vars6-values6] tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_file[aws_config_with_secret.ini-expected_keys0] tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_file[aws_config_with_session_token.ini-expected_keys1] tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_file[aws_config_with_secret_and_session_token.ini-expected_keys2] tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_file[aws_config_with_multiple_sections.ini-expected_keys3] tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_file[aws_config_without_secrets.ini-expected_keys4] tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_file[nonsense.txt-expected_keys5] tests/detect_aws_credentials_test.py::test_get_aws_secrets_from_file[ok_json.json-expected_keys6] tests/detect_aws_credentials_test.py::test_detect_aws_credentials[aws_config_with_secret.ini-1] tests/detect_aws_credentials_test.py::test_detect_aws_credentials[aws_config_with_session_token.ini-1] tests/detect_aws_credentials_test.py::test_detect_aws_credentials[aws_config_with_multiple_sections.ini-1] tests/detect_aws_credentials_test.py::test_detect_aws_credentials[aws_config_without_secrets.ini-0] tests/detect_aws_credentials_test.py::test_detect_aws_credentials[nonsense.txt-0] tests/detect_aws_credentials_test.py::test_detect_aws_credentials[ok_json.json-0] tests/detect_aws_credentials_test.py::test_non_existent_credentials
pre_commit_hooks/detect_aws_credentials.py
pre_commit_hooks/detect_aws_credentials.py