How to Create a Github Repository from the Command Line

How to Create a Github Repository from the Command Line

how to create a github repository from the command line


Git is a great version control system and Github is superb hosting service for git based repositories.

Github provides a nice web interface to create (blank) repositories at the start of the project. But why visit to create a blank repository, so here’s a simple bash script to make this simple task even simpler.


dir_name=`basename $(pwd)`
if [ $repo_name = ]; then
echo -n Repo name [$dir_name]?:
read repo_name
if [ $repo_name = ]; then
username=`git config`
if [ $username = ]; then
echo -n Could not find username, run ‘git config -global <username>’
return 1
token=`git config user.token`
if [ $token = ]; then
echo -n Could not find token, run ‘git config -global user.token <token>’
return 1
echo -n Creating Github repository ‘$repo_name‘…
curl -u $username:$token -d {“name”:”$repo_name“} > /dev/null 2>&1
echo Done.
echo -n Adding remote…
git remote add origin$username/$repo_name.git
echo Done.
view rawgit-create.bash hosted with ❤ by GitHub


Script is based on Curl and GithubApi.


Add this to bash_profile and reload it. Done 🙂
Use git-create to summon 146822610729350.

Be sure to configure GitHub username and access_token in global git configure file.


git config --global <username>

git config --global user.token <access_token>


About RemotePanda

RemotePanda is a personalized platform for companies to hire remote talent and get the quality work delivered from the city Pune. The resources in our talent pool are our close network connections. While connecting them with you, we make sure to manage the quality, growth, legalities, and the delivery of their work. The idea is to make remote work successful for you. Get in touch with us to learn why RemotePanda is the best fit solution for your business requirements.

Comments are closed.