For GitHub (not git itself), the GitHub API provides a way to create a file without cloning:
https://developer.github.com/v3/repos/contents/#create-a-file
PUT /repos/:owner/:repo/contents/:path
# Parameters #
----------------------------------------------------------------
Name     Type    Description
------   ------  -----------------------------------------------
path     string  Required. The content path.
message  string  Required. The commit message.
content  string  Required. The new file content, Base64-encoded.
branch   string  Branch name. Default: repo's default branch.
Minimal example JSON input:
{
  "message": "my commit message",
  "content": "bXkgbmV3IGZpbGUgY29udGVudHM="
}
So you can write a script to base64-encode the file contents, then have it use curl or such to send some JSON as above to https://api.github.com/repos/:owner/:repo/contents/:path
If it succeeds, you get a JSON response back including the GitHub URL(s) for the created file.
Can also update without cloning: https://developer.github.com/v3/repos/contents/#update-a-file