itz-puneet opened a new pull request, #74938:
URL: https://github.com/apache/airflow/pull/74938

   Adds a `git_config` extra to the Git connection: a JSON object of git 
configuration keys and values that the hook passes to every git command it 
runs, through the same `GIT_CONFIG_*` mechanism it already uses for the token 
credential helper.
   
   This follows the direction in #54829: instead of Airflow building an 
`Authorization` header, users can pass any git configuration themselves. For 
the rate-limit case in the issue, `http.<url>.proactiveAuth` (git 2.46 or 
higher) makes git send the connection's token on the first request. A public 
repository never answers 401, so without it every fetch is anonymous even when 
the connection has a token:
   
   ```json
   {
       "git_config": {
           "http.https://gitlab.example.com/.proactiveAuth": "basic"
       }
   }
   ```
   
   - Entries are appended after any `GIT_CONFIG_*` the deployment already 
exports and before the hook's own credential-helper entries, so the token 
configuration still wins for keys both set.
   - Values must be strings, numbers or booleans (booleans are written as 
`true`/`false`); anything else raises `ValueError` when the hook is created.
   - The append/restore logic the token credential helper had is moved into one 
helper used by both; the token path's entries and their order are unchanged.
   - Like `host_proxy_cmd` and `ssh_config_file`, this lets whoever edits the 
connection change how git runs on the worker, which the security model already 
grants to connection configuration users.
   - Docs: the extra and the `proactiveAuth` example in `connections/git.rst`.
   
   Tests: run with `uv run --project providers/git pytest` on `ubuntu-24.04` 
with git 2.55. Without the hook change, all 8 new tests fail. With it, every 
hook test passes, including an end-to-end check that git sends the token to a 
loopback server that never answers 401 (skipped on git older than 2.46). In the 
rest of the provider's tests, 179 pass and 4 error at setup in 
`bundles/test_git.py::test_initialize_survives_a_bare_repo_that_cannot_be_rewritten`
 with `ModuleNotFoundError: No module named 'airflow_shared'`, which the 
standalone `uv run --project providers/git` environment does not install; I did 
not run them in Breeze. `ruff` 0.16.8 format and check are clean.
   
   closes: #54829
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes. AI tooling helped write this change; I have reviewed all of the 
code and understand it.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to