Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save samuelematias/bed8d7f6471fcff24803def604c65066 to your computer and use it in GitHub Desktop.
Save samuelematias/bed8d7f6471fcff24803def604c65066 to your computer and use it in GitHub Desktop.
Create file in GitHub Repo via API - Example
#!/bin/bash
MESSAGE="test"
TOKEN=$(cat ~/.github-token)
FILENAME="$RANDOM-date.txt"
CONTENT=$(date | base64)
USER="steinbrueckri"
REPO="api-test"
MESSAGE="hello world"
http PUT https://api.github.com/repos/$USER/$REPO/contents/$FILENAME \
Authorization:" token $TOKEN" \
message="$MESSAGE" \
content="$CONTENT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment