Last active
July 31, 2024 16:49
-
-
Save mtilson/2334f7955c0a1b13d64b21c4f79cf16f to your computer and use it in GitHub Desktop.
how to run Shell commands from GitHub with help of Curl and shortened Git.io URLs [github]
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
## How to run Shell commands from GitHub with help of Curl and shortened Git.io URLs [github] | |
# With help of GitHub web UI create public repository (repository name: `REPO`) under | |
# your GitHub user account (user name: `USER`). This results in Git repository URL | |
# of `https://github.com/USER/REPO.git` | |
# Initialize local Git repository and create, commit, and push to the `master` branch | |
# (or other one) a file (file name: `run`) with shell commands you'd like to run | |
git init | |
git remote add origin https://github.com/USER/REPO.git | |
cat > run << _EOF | |
#!/bin/sh | |
set -e | |
echo "Hello World" | |
_EOF | |
git add run | |
git commit -m "init+cmd" | |
git push -u origin master | |
# With help of GitHub web UI get 'raw' link to the commited file, for `master` | |
# branch it should be: `https://raw.githubusercontent.com/USER/REPO/master/run` | |
# Setup `git.io` shorten URL by specifying your own code | |
curl -i https://git.io \ | |
-F "url=https://raw.githubusercontent.com/USER/REPO/master/run" \ | |
-F "code=vanity-command" | |
# Now you can run the commands with | |
curl -sL https://git.io/vanity-command | bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment