@@ -91,7 +91,7 @@ def _init_pyproject(
9191 readme_format : str = "md" ,
9292 allow_layout_creation_on_empty : bool = False ,
9393 ) -> int :
94- from poetry . core . vcs . git import GitConfig
94+ from dulwich . config import StackedConfig
9595
9696 from poetry .config .config import Config
9797 from poetry .layouts import layout
@@ -116,8 +116,6 @@ def _init_pyproject(
116116 )
117117 return 1
118118
119- vcs_config = GitConfig ()
120-
121119 if is_interactive :
122120 self .line ("" )
123121 self .line (
@@ -148,10 +146,19 @@ def _init_pyproject(
148146 if not description and is_interactive :
149147 description = self .ask (self .create_question ("Description []: " , default = "" ))
150148
149+ vcs_config = StackedConfig .default ()
150+
151+ def get_vcs_config_value (* keys : str ) -> bytes | None :
152+ try :
153+ value = vcs_config .get (* keys )
154+ except KeyError :
155+ value = None
156+ return value
157+
151158 author = self .option ("author" )
152- if not author and vcs_config . get ( "user. name" ):
153- author = vcs_config [ "user.name" ]
154- author_email = vcs_config . get ( "user. email" )
159+ if not author and ( vcs_username := get_vcs_config_value ( "user" , " name") ):
160+ author = str ( vcs_username )
161+ author_email = str ( get_vcs_config_value ( "user" , " email") )
155162 if author_email :
156163 author += f" <{ author_email } >"
157164
0 commit comments