Pushing your work to GitHub/BitBucket: Doing it the hard way, confidently!

Andela devs

I was first introduced to distributed version control systems (DVCS) — Git precisely — some time last year. I got my hands dirty with it a couple of times, picking up the basic commands to push my work to the cloud.

However, I got busy with other things, stopped practicing and as a result almost completely forgot the commands, even the most simplest ones.

Since I knew I’ll need it in the nearest future — because what’s a software developer who can’t use a DVCS? — I came up with a way to master it: code up any randomly picked mock-up and push to GitHub/BitBucket, which are both Git-based.

So far, I’ve coded up a 9mobile site designed by Cregital’s Habeeb Sanni, GTB’s logo and a credit card image I found online and pushed all to BitBucket and GitHub. I pushed them all the “easy way”.

Now you’re wondering what the easy way is, right? Okay…I’ll tell ya!

The easy way involves creating a repo on any of the Git software, cloning the repo to my laptop, copying and pasting all my files into the cloned repo and pushing to the Git software online, like so:

i) Create repo

Wakanda repo…because why not?

ii) Clone repo

git clone

iii) git add; git commit; git push

add; commit; push

iv) …and we’re good!

done pushing

v) All our files in our master repo


Easy Peasy, innit? You’ll agree with me.

However, there’s another way which I’ve come to find very challenging and took me a while to crack. I call it the hard way! At first, I didn’t want to bother learning it since I had the easy way to call upon, but I knew I just had to know it for me and for others who might be having same issue.

So, here goes the hard way of pushing your work. Sit tight and follow:

i) create repo (on BitBucket, because I’m loving it more than GitHub)

creating repo on BitBucket

ii) mkdir; git init; git add; git commit

iii) git remote add origin <url>; git push

iv) BitBucket overview.

1. our repo containing pushed/committed files
2. our repo containing pushed/committed files

We’re done. Phhheeewwww!!! That wasn’t easy.

I’m sure you’ve noticed the differences between both ways, if you followed. Now, let’s talk about those differences.

The thing with the hard way is since you plan to push your local work to your preferred Git-based software, you first need to prepare it for that purpose, and this where “git init” comes in. This command simply turns your work folder into a Git repo.

After git adding and git committing your work, you need to push to the Git-based software online. You need to create a “remote”, or online, repo and make sure both your local and remote see each other, else you won’t be able to push your work to the remote.

This magic is done with the git remote add origin <url> command, with the origin being the remote name and the web address the remote URL i.e https://nsembo@bitbucket.org/nsembo/hardcommit.git

Once the above is successfully done(see image iii above), you can then push online using “git push -u origin master”, without the quotes of course, with master being our local branch name and -u enabling us to just “git push” next time and Git will know what to do.

So there you have it. This looks pretty easy now but few weeks back I couldn’t crack it. If you’re having similar challenge, just follow through and you’ll be good. You can use the comment section below to share your thoughts.

Although every software developer out there still perform these basic task every now and then, this is just the beginning of Git. There’s a gang load of stuff to learn about it, and you definitely should. I’ve come to find Atlassian’s Git tutorial very useful, as well as this tutorial created by Code School.

If you find this article helpful, please share (👏) so others too can benefit from it. Thanks!!!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Udoh N. Kelven

Udoh N. Kelven

I don’t have passion — I simply find something to do & give it my all!