Pushing to Bitbucket git Repository & Decoupling From Any Server Instance
by Mike Levin SEO & Datamaster, 10/08/2013
Okay, A HUGELY IMPORTANT ASPECT of the way I work is that the particular server execution environment is of almost no consequence. I encourage the use of the QEMU-based desktop virtual machine that I call Levinux, because so many people are on Intel/AMD-based Windows, Mac and Linux desktop systems. But because it is such a short development stack, and the server build recipes are so exposed and reproducible, I can slam the requirements onto almost any Linux server that has a repository system like yum or apt-get on it. All the pip commands remain the same. That being said, the next logical step for me now is to push this code up to either bitbucket.org or github.com. The important thing is getting it up into a repository! Bitbucket can let you keep the repository private at no extra cost, and github leads you down this path where private repositories cost you. Soooo… Hmmmm. For the sake of proprietary-ness, I’m going to put it on Bitbucket as private, keeping my options open for making it public later.
So, go to Bitbucket and log in, which will forward you to https://bitbucket.org/dashboard/overview. Then, click Create Repository. Give it a name, choose Python as the Language, and click Create Repository. I haven’t done a git init yet, so click: “I’m starting from scratch”.
Then, in your terminal that’s logged into your local Levinux:
cd into your working directory where you put some code, and type: git init
Then, type: git add doauth.py (that’s what I named my Python file).
Then, type the command to set the repository origin:
git remote add origin https://firstname.lastname@example.org/miklevin/levinux-oauth2-example.git
Try to do a git commit, and then follow the instructions about doing git conifig to set up your name and email on the repository.
git config –global user.email “[my email address]” git config –global user.name “Mike Levin”
And then do the commit for real:
git commit -m “Going to do OAuth2 on Levinux”
…and then when you see that it actually worked, you can do a push. You will be prompted for your password, which is your normal Bitbucket password:
git push -u origin master
You should now be able to see your latest activity on your Bitbucket overview screen. If so, congratulations. You have completely decoupled your brilliant work from any particular instance of a server, and particularly, any excessively vendor-specific cloud platforms - favoring instead, extremely lightweight generic Linux that closely mimics embedded systems. And now that I’ve pushed it up to Bitbucket, I can download my Linux execution environment at any Intel/AMD-based PC or Mac or Linux machine I sit down at, and then I can log into it and do a git pull from Bitbucket, and continue my work.
It’s all very sorcerer’s apprentice. One spell to build the server. Another spell to get your project installed. Then you run it right off of your desktop, with the server at http://localhost:8888. If you NEED to have it hosted with a domain name, you can quickly build the server you need with yum or apt-get commands for big program repository stuff, and then with pip for all the Python stuff. The power comes from doing this stuff anywhere, and understanding really what you’re doing! It’s a slightly longer path, but worth it!
Okay, I want to go meet Rachel at NYPD headquarters for the ceremony honoring her dad, Wilhelm Figueora, as the man of the year by the NYPD Hispanic Society. He’s the only civilian honoree.