ezyang / ghstack

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

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

Open pluiez opened 1 week ago

pluiez commented 1 week ago

Hi, I'm using privately hosted gitlab and encounterd the following error. I have checked #162 and #244 but I cound't find solution to my problem.

ERROR: Fatal exception
Traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.12/site-packages/ghstack/logs.py", line 105, in manager
    yield
  File "/opt/anaconda3/lib/python3.12/site-packages/ghstack/cli.py", line 46, in cli_context
    yield shell, config, github
  File "/opt/anaconda3/lib/python3.12/site-packages/ghstack/cli.py", line 258, in submit
    ghstack.submit.main(
  File "/opt/anaconda3/lib/python3.12/site-packages/ghstack/submit.py", line 260, in main
    submitter = Submitter(**kwargs)
                ^^^^^^^^^^^^^^^^^^^
  File "<string>", line 24, in __init__
  File "/opt/anaconda3/lib/python3.12/site-packages/ghstack/submit.py", line 380, in __post_init__
    repo = ghstack.github_utils.get_github_repo_info(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/ghstack/github_utils.py", line 71, in get_github_repo_info
    name_with_owner = get_github_repo_name_with_owner(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/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@git.COMPANY_NAME.com:PROJECT_NAME/TEAM_NAME/REPO_NAME.git
ezyang commented 1 week ago

Whoops. This is probably not hard to adjust the regex, feel free to send a PR or maybe eventually I will get to it

pluiez commented 1 week ago

Whoops. This is probably not hard to adjust the regex, feel free to send a PR or maybe eventually I will get to it

I set the github_url field in .ghstackrc, but it comes to another error:

ERROR: Fatal exception
Traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.12/site-packages/ghstack/logs.py", line 105, in manager
    yield
  File "/opt/anaconda3/lib/python3.12/site-packages/ghstack/cli.py", line 46, in cli_context
    yield shell, config, github
  File "/opt/anaconda3/lib/python3.12/site-packages/ghstack/cli.py", line 258, in submit
    ghstack.submit.main(
  File "/opt/anaconda3/lib/python3.12/site-packages/ghstack/submit.py", line 262, in main
    submitter = Submitter(**kwargs)
                ^^^^^^^^^^^^^^^^^^^
  File "<string>", line 24, in __init__
  File "/opt/anaconda3/lib/python3.12/site-packages/ghstack/submit.py", line 382, in __post_init__
    repo = ghstack.github_utils.get_github_repo_info(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/ghstack/github_utils.py", line 95, in get_github_repo_info
    repo = github.graphql(
           ^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/ghstack/github_real.py", line 115, in graphql
    raise RuntimeError(pretty_json)
RuntimeError: {
 "errors": [
  {
   "message": "Field 'repository' doesn't exist on type 'Query'",
   "locations": [
    {
     "line": 3,
     "column": 13
    }
   ],
   "path": [
    "query",
    "repository"
   ],
   "extensions": {
    "code": "undefinedField",
    "typeName": "Query",
    "fieldName": "repository"
   }
  },
  {
   "message": "Variable $owner is declared by anonymous query but not used",
   "locations": [
    {
     "line": 2,
     "column": 9
    }
   ],
   "path": [
    "query"
   ],
   "extensions": {
    "code": "variableNotUsed",
    "variableName": "owner"
   }
  },
  {
   "message": "Variable $name is declared by anonymous query but not used",
   "locations": [
    {
     "line": 2,
     "column": 9
    }
   ],
   "path": [
    "query"
   ],
   "extensions": {
    "code": "variableNotUsed",
    "variableName": "name"
   }
  }
 ]
}
ezyang commented 1 week ago

beh, this might be some sort of private github difference. This query doesn't matter, what happens if you patch it to hard code your info?

pluiez commented 6 days ago

beh, this might be some sort of private github difference. This query doesn't matter, what happens if you patch it to hard code your info?

Sorry, I am not familiar with how the git cilent communicates with host server. What is the "query" used for? What is the desired hard coding I should try?

ezyang commented 5 days ago

It's a few things, but I think the main load bearing one is knowing what the default branch is