question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

git install doesn't recognize new `main` default branch

See original GitHub issue

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

  1. poetry add git+https://github.com/AGeekInside/fastapi-jinja.git#main
  2. pip install git+https://github.com/AGeekInside/fastapi-jinja.git

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:17
  • Comments:21 (7 by maintainers)

github_iconTop GitHub Comments

14reactions
abncommented, Nov 16, 2020

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.

6reactions
lambdalisuecommented, May 19, 2021

I still faced this issue on the latest Poetry (1.1.6)

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found