Last active
May 3, 2024 09:44
-
-
Save aborruso/40aee4f1738c0a0e3727bf7cbec91152 to your computer and use it in GitHub Desktop.
How to update a file in github via cURL
This file contains 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
#!/bin/bash | |
cartella="/var/myfolder" | |
# update the file | |
curl -i -X PUT -H 'Authorization: token 4d013330xxxxxxxxxxxxxx' -d "{\"path\": \"mattei.csv\", \ | |
\"message\": \"update\", \"content\": \"$(openssl base64 -A -in $cartella/mattei.csv)\", \"branch\": \"master\",\ | |
\"sha\": $(curl -X GET https://api.github.com/repos/username/repo/contents/mattei.csv | jq .sha)}" \ | |
https://api.github.com/repos/username/repo/contents/mattei.csv |
This helped me today, thank you.
Only to say that I'm very happy to have helped you @defrindr @jamlevi @elect86 and @zpostfacto
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Quite valuable indeed, grazie Andrea!