nailo2c opened a new pull request, #52897:
URL: https://github.com/apache/airflow/pull/52897
Closes: #52332
# Why
A corner case in `GitDagBundle` causes pulling DAGs from a private GitHub
repository to fail whenever `repo_url` is set in `dag_bundle_config_list`.
# How
Move the `try / except` block before the `repo_url` detection so that the
GitHook is always created.
# What
I tested with a private repo and created an example DAG:
```python
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.bash import BashOperator
default_args = {
"owner": "airflow",
"depends_on_past": False,
"retries": 1,
"retry_delay": timedelta(minutes=5),
}
with DAG(
dag_id="hello_airflow",
default_args=default_args,
description="A simple hello-world DAG",
schedule="0 0 * * *",
start_date=datetime(2025, 7, 4),
catchup=False,
tags=["example"],
) as dag:
say_hello = BashOperator(
task_id="say_hello",
bash_command='echo "Hello Airflow!"',
)
```

Bundle configuration
```console
dag_bundle_config_list = [{"name": "dags-folder", "classpath":
"airflow.providers.git.bundles.git.GitDagBundle", "kwargs": {"repo_url":
"[email protected]:nailo2c/my_repo.git" , "tracking_ref": "main", "subdir":
"dags"}}]
```
Git connection
```console
airflow connections add git_default \
--conn-json '{
"conn_type": "git",
"login": "git",
"host": "github.com",
"extra": {
"private_key": "*****",
"strict_host_key_checking": "no"
}
}'
```
It works well

--
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]