ezyang / ghstack

Submit stacked diffs to GitHub on the command line
MIT License
657 stars 54 forks source link

Couldn't determine repo owner and name from url #244

Closed JackCaoG closed 7 months ago

JackCaoG commented 7 months ago

I tried to use ghstack and run into issue

/workspaces/dk2/pytorch# ghstack
NB: configuration saved to /root/.ghstackrc
$ git remote get-url origin
ERROR: Fatal exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/ghstack/logs.py", line 105, in manager
    yield
  File "/usr/local/lib/python3.10/site-packages/ghstack/cli.py", line 46, in cli_context
    yield shell, config, github
  File "/usr/local/lib/python3.10/site-packages/ghstack/cli.py", line 252, in submit
    ghstack.submit.main(
  File "/usr/local/lib/python3.10/site-packages/ghstack/submit.py", line 260, in main
    submitter = Submitter(**kwargs)
  File "<string>", line 24, in __init__
  File "/usr/local/lib/python3.10/site-packages/ghstack/submit.py", line 378, in __post_init__
    repo = ghstack.github_utils.get_github_repo_info(
  File "/usr/local/lib/python3.10/site-packages/ghstack/github_utils.py", line 71, in get_github_repo_info
    name_with_owner = get_github_repo_name_with_owner(
  File "/usr/local/lib/python3.10/site-packages/ghstack/github_utils.py", line 44, in get_github_repo_name_with_owner
    raise RuntimeError(
RuntimeError: Couldn't determine repo owner and name from url: git@github.com:/pytorch/pytorch.git

I tried to figure out what happened and saw

> /usr/local/lib/python3.10/site-packages/ghstack/github_utils.py(41)get_github_repo_name_with_owner()
-> if m:
(Pdb) search
'github.com/([^/]+)/(.+?)(?:\\.git)?$'
(Pdb) remote_url
'git@github.com:/pytorch/pytorch.git'

I am a regrex noob so I want to use https://regex101.com/ to check but it complains about the regrex / An unescaped delimiter must be escaped; in most languages with a backslash (\).

I tried to run ghstack on both existing branch and main branch(after committing a random commit) and got the same error.

Version

ghstack: 0.9.3 python: 3.10

ezyang commented 7 months ago

This is a bug. To workaround, edit .git/config and remove the slash after git@github.com: so you have git@github.com:pytorch/pytorch.git