poetry: git install doesn't recognize new `main` default branch
poetry add git+https://github.com/AGeekInside/fastapi-jinja.git
result in exception since it is tires to checkout master
branch.
poetry add git+https://github.com/AGeekInside/fastapi-jinja.git
Updating dependencies
Resolving dependencies...
CalledProcessError
Command '['git', '--git-dir', 'C:/Users/n2/AppData/Local/Temp/pypoetry-git-fastapi-jinjau3blv69e/.git', '--work-tree', 'C:/Users/n2/AppData/Local/Temp/pypoetry-git-fastapi-jinjau3blv69e', 'checkout', 'master']' returned non-zero exit status 1.
at ~\.poetry\lib\poetry\utils\_compat.py:217 in run
213│ process.wait()
214│ raise
215│ retcode = process.poll()
216│ if check and retcode:
→ 217│ raise CalledProcessError(
218│ retcode, process.args, output=stdout, stderr=stderr
219│ )
220│ finally:
221│ # None because our context manager __exit__ does not use them.
as the default branch name has changed, poetry should both accept main
and master
.
the workaround is
poetry add git+https://github.com/AGeekInside/fastapi-jinja.git#main
pip install git+https://github.com/AGeekInside/fastapi-jinja.git
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 16
- Comments: 22 (7 by maintainers)
Commits related to this issue
- Let poetry use default branch if none is specified. Resolves: python-poetry/poetry#3366 — committed to david-fortini/poetry-core by david-fortini 3 years ago
- Let poetry use default branch if none is specified. Resolves: python-poetry/poetry#3366 — committed to python-poetry/poetry-core by david-fortini 3 years ago
- Revert "Let poetry use default branch if none is specified. Resolves: python-poetry/poetry#3366" This reverts commit 28b7a07a782327bc2bf09067ab2518ff0e5ea732. — committed to abn/poetry-core by abn 3 years ago
- Revert "Let poetry use default branch if none is specified. Resolves: python-poetry/poetry#3366" This reverts commit 28b7a07a782327bc2bf09067ab2518ff0e5ea732. — committed to python-poetry/poetry-core by abn 3 years ago
Poetry should simply not specify a branch by default. This should then default to whatever is the server default and this should adhere to expected behaviour. Might require removing this “master is default” assumption at multiple points in the code. PR welcome.
As for the error messages. There is very little we can do here at the moment since the
git
command is being processed as a subprocess call and errors can happen at various nested levels. Moving to a native python library will help with this in the future. As for immideate improvements, if you can identify any easy wins within the current error handling, PR is welcome, but maybe open another issue for that.I still faced this issue on the latest Poetry (1.1.6)
Yes, as far as I can tell, there is no PR yet so you’d be first.
It is fixed by https://github.com/python-poetry/poetry-core/pull/192 which is available in poetry-core 1.1.0a7. So this will be fixed by (re)intalling the latest poetry pre-release version (1.2.0a2).
As far as I can tell, yes. At least, I would start with poetry-core. Then it will show if some more modifications are needed in poetry or not.
Is this still open? I could try to tackle this as my first issue.