diff --git a/mytoolkit/commands/git.py b/mytoolkit/commands/git.py index c735515..8a8bb6d 100644 --- a/mytoolkit/commands/git.py +++ b/mytoolkit/commands/git.py @@ -11,12 +11,22 @@ from mytoolkit.config import config def _get_proxies() -> dict[str, str]: - """Get git proxies from config.""" - proxies = {} + """Get git proxies from config. + + Prefers hierarchical ``connections.proxy.``; falls back to legacy + flat ``proxy_`` keys for older configs. + """ + proxies: dict[str, str] = {} + nested = config.get("connections.proxy") + if isinstance(nested, dict): + for name, value in nested.items(): + if isinstance(value, str) and value: + proxies[str(name)] = value + if proxies: + return proxies for key, value in config.get_all().items(): - if key.startswith("proxy_"): - name = key[6:] # Remove 'proxy_' prefix - proxies[name] = value + if key.startswith("proxy_") and isinstance(value, str) and value: + proxies[key[6:]] = value return proxies