Creating github repo from command line

So, I’ve been looking into git and github lately, since I need some way to keep the code I’m working on up to date and be able to see what changes I’ve made.

I like the ability to run git commands from the command line and was looking into creating a github repo from the command line.
It was way easier than I thought.


curl -u 'username' -H "X-GitHub-OTP: xxxxxx" https://api.github.com/user/repos -d '{"name":"reponame"'}

The curl -u sets the username to use and the -H “X-GitHub-OTP: xxxxxx” part is for the google authenticator that I use and the xxxxxx is the one-time code. Works great.

It calls on the api that github has and with the -d ‘{“name”:”reponame”‘} you tell github what you want to call the repo.

I set up my account with a access token also, so it is as easy as:

git init

git remote add origin https://username:token@github.com/username/reponame.git

git add file

git commit -m "Your comment"

git push origin master

And with that the new repo is up and running and git is set up and ready to go. Time to push some code up on github.

Updated the site with Lets Encrypt

I like to use secure communication as much as possible since we never know what new threats are out on the web. I don’t think I’ve got the skill set to battle of the best hackers, but stopping at least the script kiddies and such should be possible.

So first I ran a update so that I was sure everything is good to go.

sudo yum update

I then went and install git so that I can download the letsencrypt software.

sudo yum install git

I then downloaded letsencrypt and setup apache for ssl.

sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt

cd /opt/letsencrypt

./letsencrypt-auto --apache -d example.com -d www.example.com

You get some questions and one of them are if you want http and https or redirect to https. I chose redirect since I want the site to always use https.

Letsencrypt puts the files in /etc/httpd/sites-enabled so I moved the to sites-avaliable and made a symlink to enabled instead.

After a restart of httpd the site is up and running with https 🙂

I then ran a test of the server on ssl labs ssl test.
It complained about SSLv3, so I had to fix that.

So I located ssl.conf under /etc/httpd/conf.d and located

SSLProtocol all -SSLv2

and added -SSLv3 to it.

Kurt