Created
November 14, 2013 12:50
-
-
Save aslakhellesoy/7466252 to your computer and use it in GitHub Desktop.
Can't create a new empty file on GitHub using API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This works | |
| curl -u USER:PASS https://api.github.com/repos/USER/REPO/contents/a.txt --request PUT --data-ascii $'{"path": "a.txt", "content": "bXkgbmV3IGZpbGUgY29udGVudHM=", "message": "hello"}' | |
| # Does not work | |
| curl -u USER:PASS https://api.github.com/repos/USER/REPO/contents/a.txt --request PUT --data-ascii $'{"path": "a.txt", "content": "", "message": "hello"}' | |
| # HTTP status 422. Body: | |
| # { | |
| # "message": "content is not valid Base64", | |
| # "documentation_url": "http://developer.github.com/v3/repos/contents/" | |
| # } | |
| # However, this creates an empty (0 bytes) file: | |
| echo "" | base64 --decode > tmp.txt && ls -al tmp.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment