I ran into the same problem today. After reading through this thread I realized perhaps it had to do with having both Pythonista 2 and the new Pythonista 3 installed. I uninstalled both and reinstalled 3 and it fixed the problem.
keychain.setpassword is a Python function in the keychain module provided by Pythonista. You need to use it in Pythonista's Python console, not in Stash. (Also don't forget to run import keychain first, so you can use the keychain module in the console.)
iirc the stash git tutorial had a review of how to use ssh-keygen, and then how to upload to git. Then you can use git remote to add a link to the ssh://firstname.lastname@example.org/tourname/yourrepo.git url, (i usually name it sshorigin) then git push sshorigin should work. I think there is a size limit for the https in dulwich.
@dgelessus , thanks so much. Took the debug out and it works. But I am almost sure that it used to work. Maybe I am wrong.
But really, thank you. It's great it's working.
I finally got PythonAnywhere working today the way I want. I just had to watch a video :). here I just have the basic todo list example from the docs working. But I finally figured out how to install and configure a virtualenv there.