3043: Always got 'bad credentials' when adding a github repository
- Fixed
- Review Board
qil****@gmai***** (Google Code) (Is this you? Claim this profile.) | |
Aug. 7, 2013 |
What version are you running? 1.7.11 What's the URL of the page containing the problem? reviewboard.xxx.com/reviews/admin/db/scmtools/repository/add/ What steps will reproduce the problem? 1.add repository 2.select github as hosting service 3.fill up account username/password 4.fill up all other required info 5.click save What is the expected output? What do you see instead? Always got "unable to link the account: bad credentials" What operating system are you using? What browser? rb server, ubuntu Please provide any additional information below. the log showed, None - xxx - /reviews/admin/db/scmtools/repository/add/ - Internal Server Error: /reviews/admin/db/scmtools/repository/add/ Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/Django-1.4.5-py2.5.egg/django/core/handlers/base.py", line 111, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/usr/lib/python2.5/site-packages/Django-1.4.5-py2.5.egg/django/contrib/admin/options.py", line 366, in wrapper return self.admin_site.admin_view(view)(*args, **kwargs) File "/usr/lib/python2.5/site-packages/Django-1.4.5-py2.5.egg/django/utils/decorators.py", line 91, in _wrapped_view response = view_func(request, *args, **kwargs) File "/usr/lib/python2.5/site-packages/Django-1.4.5-py2.5.egg/django/views/decorators/cache.py", line 89, in _wrapped_view_func response = view_func(request, *args, **kwargs) File "/usr/lib/python2.5/site-packages/Django-1.4.5-py2.5.egg/django/contrib/admin/sites.py", line 196, in inner return view(request, *args, **kwargs) File "/usr/lib/python2.5/site-packages/Django-1.4.5-py2.5.egg/django/utils/decorators.py", line 25, in _wrapper return bound_func(*args, **kwargs) File "/usr/lib/python2.5/site-packages/Django-1.4.5-py2.5.egg/django/utils/decorators.py", line 91, in _wrapped_view response = view_func(request, *args, **kwargs) File "/usr/lib/python2.5/site-packages/Django-1.4.5-py2.5.egg/django/utils/decorators.py", line 21, in bound_func return func(self, *args2, **kwargs2) File "/usr/lib/python2.5/site-packages/Django-1.4.5-py2.5.egg/django/db/transaction.py", line 224, in inner return func(*args, **kwargs) File "/usr/lib/python2.5/site-packages/Django-1.4.5-py2.5.egg/django/contrib/admin/options.py", line 937, in add_view if form.is_valid(): File "/usr/lib/python2.5/site-packages/ReviewBoard-1.7.11-py2.5.egg/reviewboard/scmtools/forms.py", line 937, in is_valid if not super(RepositoryForm, self).is_valid(): File "/usr/lib/python2.5/site-packages/Django-1.4.5-py2.5.egg/django/forms/forms.py", line 124, in is_valid return self.is_bound and not bool(self.errors) File "/usr/lib/python2.5/site-packages/Django-1.4.5-py2.5.egg/django/forms/forms.py", line 115, in _get_errors self.full_clean() File "/usr/lib/python2.5/site-packages/ReviewBoard-1.7.11-py2.5.egg/reviewboard/scmtools/forms.py", line 754, in full_clean super(RepositoryForm, self).full_clean() File "/usr/lib/python2.5/site-packages/Django-1.4.5-py2.5.egg/django/forms/forms.py", line 271, in full_clean self._clean_form() File "/usr/lib/python2.5/site-packages/Django-1.4.5-py2.5.egg/django/forms/forms.py", line 299, in _clean_form self.cleaned_data = self.clean() File "/usr/lib/python2.5/site-packages/ReviewBoard-1.7.11-py2.5.egg/reviewboard/scmtools/forms.py", line 790, in clean self._clean_bug_tracker_info() File "/usr/lib/python2.5/site-packages/ReviewBoard-1.7.11-py2.5.egg/reviewboard/scmtools/forms.py", line 582, in _clean_bug_tracker_info self.cleaned_data['hosting_account'].username AttributeError: 'NoneType' object has no attribute 'username'
Two things seem to be happening. First, we're not handling the failure case well at all. Second, GitHub is telling us that your login/password is invalid. Can you verify that you are able to log into GitHub with that exact same login/password? If so, is there anything "special" about your password? Really odd characters, like Unicode characters?
-
+ NeedInfo
First, I didn't quite understand that 'link a new account' means linking to an existed account or linking to a unexisted account, in later case, github would create one for rb, by guess. I tried either way, both failed. 1. For an existed account, got 'created' error returned by rb. I'm pretty sure login/pwd was correct, and only acsii letters and numbers inside. 2. For unexisted account, got 'bad credentials' but the log showed same error 'NoneType' object has no attribute 'username' for both way. P.S the browser is ff22, Windows 8 and Mac OSX 10.8
I also tried another way. 1. Hosting service - none custom 2. Repo info, Git Path - a git url to github Raw file url mask - don't know how to set it, tried several User, Password - my github account 3. Publicly accessible 4. Uploaded my ssh key Now the problem is diff may get generated, but can't diff in rb, error info Diff currently unavailable. Error: The patch to 'README.md' didn't apply cleanly. The temporary files have been left in '/tmp/reviewboard.7QKhnj' for debugging purposes. `patch` returned: patching file /tmp/reviewboard.7QKhnj/tmpePd_8S Hunk #1 FAILED at 5. 1 out of 1 hunk FAILED -- saving rejects to file /tmp/reviewboard.7QKhnj/tmpePd_8S-new.rej Any hint? thanks.
Yeah, you have to use GitHub in Hosting Service in order for diffs to render. It cannot work with Custom, because we need to use GitHub's API. "Link a new account" is for establishing a new link in RB to a hosting service's account. What's the "created" error? When you say "an existed account," do you mean one already in the list, or one already on GitHub? If you don't have an item in the dropdown for your Account, then you do need to specify the GitHub login/password for your account that owns your repository. If it's giving "bad credentials," then GitHub itself is saying that the username/password you typed is not a valid username/password on GitHub. There will be a new UI in RB 1.8 that improves this entire process.
okay, I just tried once more, 1. GitHub hosting service 2. Linked to my account already on Github, user/pwd 3. Associate my SSH key with the hosting service 4. save new repo then got 'Unable to link the account: HTTP Error 201: Created' server log said the same as first post, 'AttributeError: 'NoneType' object has no attribute 'username'' weird.
HTTP 201 is not actually an error, but something thinks it is. The fact that it is indicates something outdated and confused is handling some aspect of this. It sounds like it's authenticating, but whatever is confused doesn't see that it succeeded. What browser are you using? What's your web server setup like? It's also possible this is a Python 2.5 issue. What version of 2.5 exactly are you using?
Firefox 22 I'm not the guy who set up the rb server, I'll check out with him. The python version, did you mean python on server or client?
Python on the server. Some old versions of Python had bugs where valid HTTP 2xx errors appeared as errors. Python 2.5 won't be supported for RB 1.8+, so it might be a good opportunity to do an upgrade.
firefox 22 python 2.5.2 I just tried chrome browser, failed too What web server info do you need? I'll upgrade python soon and try it out
Don't worry about the web server info. I looked into this and it's definitely a bug in Python 2.5.x. That version of Python doesn't understand several successful HTTP 2xx errors as being successful. We can work around this, and I can probably get a patch for you to apply in a day or two, but the best long-term solution is definitely an upgrade to Python 2.7.
Thanks! I’ll try upgrading python first and then your patch, tomorrow I’ll let you know the result.
Just to note: An upgrade to a new major version of Python is not trivial. You will need to install the new version alongside 2.5 and get a new version of mod_wsgi (assuming you're using that for Apache), and reinstall Review Board and its dependencies. What I'd recommend is trying this patch first, and get things working, assuming you have an existing install you need up-and-running quickly for your users. Alongside that, best way to get set up with a newer version of Python is to install a newer LInux distro that comes with it. This will also help with some of our dependencies, especially going forward. You can then start to transition the server over.
Sorry, how to apply the patch? I didn’t figure it out :(
I moved to /usr/lib/python2.5/site-packages/ReviewBoard-1.7.11-py2.5.egg then patch -p0 < ~/rbpatch/0001-Fix-HTTP-requests-on-Python-2.5.x.patch got 'can't find file to patch at input line 19’ server is ubuntu 10.04
It’s done, I had to manually input the service.py path Now I can do review over github and reviewboard. Really appreciated!