git install doesn't recognize new `main` default branch
See original GitHub issuepoetry 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#mainpip install git+https://github.com/AGeekInside/fastapi-jinja.git
Issue Analytics
- State:
- Created 3 years ago
- Reactions:17
- Comments:21 (7 by maintainers)
Top Results From Across the Web
Why does my 'git branch' have no master? - Stack Overflow
Most Git repositories use master as the main (and default) branch - if you initialize a new Git repo via git init ,...
Read more >How to change git default branch from master
In Github, go to settings -> branches. You can change the default branch there. That's it you are done.
Read more >If your first (default) branch is not named "master", the remote ...
I'm using GitLab CE 7.10.1 installed with the omnibus package (7.10.1~omnibus.2-1) on Ubuntu 14.04. On a newly empty project, ...
Read more >How to Set the Default Git Branch Name from Master to Main
The default branch name in GitHub for new repositories has already changed from master to main. You might want to make the same...
Read more >Change git init default branch name - Super User
Now when you run git init , main will be your default branch. This is similar to running git config --global init.defaultBranch main...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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
gitcommand 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)