Skip to content

Instantly share code, notes, and snippets.

@mugishap
Created March 8, 2023 03:38
Show Gist options
  • Save mugishap/dbc7b374f74e9a87aaa6eeea5c025fae to your computer and use it in GitHub Desktop.
Save mugishap/dbc7b374f74e9a87aaa6eeea5c025fae to your computer and use it in GitHub Desktop.
#!/bin/bash
rm -rf .git
git init
git add .
git commit -m "[init]: Initialized repo"
git branch main
git switch main
echo "Enter github username: "
read username
echo "Enter your github token: "
read token
echo "Enter the repo name: "
read repo_name
echo "Enter the repo description: "
read description
echo "Please wait..."
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $token"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/user/repos \
-d "{\"name\":\"$repo_name\",\"description\":\"$description\",\"private\":true}"
git remote add origin "https://github.com/$username/$repo_name.git"
git push --set-upstream origin main
clear
echo "Repo pushed successfully
Happy Coding!!!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment