Error is with $.post which is asynchonous and sets sha_blog only after post requests.
The last $.ajax request does not provide sha. DEBUG.
The issue with git send is that multiple question marks in the content renders improper json and hence $.get is use in stead of post.
Fixed bug with file creation.
Minor changes.