git-pull-request icon indicating copy to clipboard operation
git-pull-request copied to clipboard

Instructions for usage with 2FA

Open pannous opened this issue 3 years ago • 0 comments

Currently with 2FA enabled one gets the error message

Forking is disabled on target repository, can't fork

~/ git pull-request
Username for 'https://github.com': 
Password for 'https://[email protected]': 
Forking is disabled on target repository, can't fork
Traceback (most recent call last):
  File "/opt/miniconda3/lib/python3.9/site-packages/git_pull_request/__init__.py", line 521, in fork_and_push_pull_request
    repo_forked = g_user.create_fork(repo_to_fork)
  File "/opt/miniconda3/lib/python3.9/site-packages/github/AuthenticatedUser.py", line 497, in create_fork
    headers, data = self._requester.requestJsonAndCheck(
  File "/opt/miniconda3/lib/python3.9/site-packages/github/Requester.py", line 353, in requestJsonAndCheck
    return self.__check(
  File "/opt/miniconda3/lib/python3.9/site-packages/github/Requester.py", line 378, in __check
    raise self.__createException(status, responseHeaders, output)
github.GithubException.GithubException: 401 {"message": "You must be logged in to do that.", "documentation_url": "https://docs.github.com/rest/guides/getting-started-with-the-rest-api#authentication"}

Expected behaviour:

Catch and wrap the above exception to show how to use 2FA, e.g.

https://github.com/Mergifyio/git-pull-request/pull/102/files

pannous avatar May 26 '21 11:05 pannous