Open JasCodes opened 6 years ago
Sorry for the time to get back to you, days are currently flying fast for me.
Could you try again with the -v
option?
Just had this same error, here's the output with -v
:
$ git repo config -v
[...]
Do you want to configure the gitlab service?
[Yn]> y
Is your service self-hosted?
[yN]> n
Please enter your credentials to connect to the service:
username> bochecha
password>
Fatal error: 404: b'{"error":"404 Not Found"}'
------------------------------------
Traceback (most recent call last):
File "/home/mathieu/.local/lib/python3.6/site-packages/git_repo/repo.py", line 581, in main
return GitRepoRunner(args).run()
File "/home/mathieu/.local/lib/python3.6/site-packages/git_repo/kwargparse.py", line 68, in run
return self._action_dict[frozenset(args)](self)
File "/home/mathieu/.local/lib/python3.6/site-packages/git_repo/repo.py", line 573, in do_config
setup_service(service)
File "/home/mathieu/.local/lib/python3.6/site-packages/git_repo/repo.py", line 545, in setup_service
new_conf['token'] = service.get_auth_token(username, password, prompt=loop_input)
File "/home/mathieu/.local/lib/python3.6/site-packages/git_repo/services/ext/gitlab.py", line 130, in get_auth_token
gl.auth()
File "/home/mathieu/.local/lib/python3.6/site-packages/gitlab/__init__.py", line 226, in auth
self._credentials_auth()
File "/home/mathieu/.local/lib/python3.6/site-packages/gitlab/__init__.py", line 236, in _credentials_auth
r = self.http_post('/session', data)
File "/home/mathieu/.local/lib/python3.6/site-packages/gitlab/__init__.py", line 825, in http_post
post_data=post_data, files=files, **kwargs)
File "/home/mathieu/.local/lib/python3.6/site-packages/gitlab/__init__.py", line 731, in http_request
response_body=result.content)
gitlab.exceptions.GitlabHttpError: 404: b'{"error":"404 Not Found"}'
Adding some print
s to the code, I can see it tried to do a POST on https://gitlab.com/api/v4/session, with the params {'email': 'bochecha', 'password': '************'}
.
It's interesting that it sends an email but asks me for a username, but I still get the 404 error if I try with my email instead.
This seems to be the root cause: https://gitlab.com/gitlab-org/gitlab-ce/issues/42324
Ok, so the API endpoint was removed in Gitlab 10.2: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG.md#1020-2017-11-22
Remove Session API now that private tokens are removed from user API endpoints.
The python-gitlab author decided to fix the issue with documentation: https://github.com/python-gitlab/python-gitlab/issues/380#issuecomment-351293765
Can we use access token based authentication in gitlab, since /session was removed?
How do we configure python-gitlab like this :
import gitlab
# private token or personal token authentication
gl = gitlab.Gitlab('http://10.0.0.1', private_token='JVNSESs8EwWRx5yDxM5q')
for git-repo ?
source: [https://github.com/python-gitlab/python-gitlab/blob/master/docs/api-usage.rst#gitlabgitlab-class]()
ok, I haven't had a look for that. I'll look into that once I finish the current issue.
AFAICT, it still is working when configuring manually the token in the configuration (at least it does for me). But the change of scheme totally breaks the autoconfiguration tool.
PR are welcome to fix the issue 😁