Publishing your local project to Github in a lot of complicated steps
3 min read

Publishing your local project to Github in a lot of complicated steps

When it comes to version control software I'm used to working with SVN. However, the industry norm seems to be GIT so I've dabbled around with it as well, just enough to work the courage of publishing a small local project to my Github account.

But what should have a very easy and basic task ended up taking more than half an hours and lots a trips to Google. Therefore, in a clickbaiting manner, I say to you: "I struggled to publish my project so now I'm posting my experience so you won't have to"

I already the project files locally so the first thing I did was to create a new repository on Github.

github create new repository

This was a no brainer but I made the mistake to choose a license. Why was that a mistake, you will see later.

Github already has a very concise tutorial about adding an existing project using the command line so that was my starting point.

git init
git add .
git commit -m "First commit"

and I was good to go. The next step would have been to actually use the online repository, but this is where the problems started.

The process itself is easy.

git remote add origin remote https://github.com/bbog/my-project.git

It would have allowed me to push my files to Github but alas, it was not meant to be...

My first mistake was to mistype the git project's URL. Github also teaches you how to delete a remote but I ran into the "could not remove config section" and was unable to fix it. But it turns out there was a much faster solution for this particular case: just delete the .git folder from the folder. Armed with this knowledge, I deleted everything and started anew, but little did I know that I would end up repeating this process way too many times...

After correcting the URL, I ran into another problem: Git was unable to find remote helper for https://. Changing the url from https://github.com/bbog/my-project.git to git://github.com/bbog/my-project.git did not help and it turns out I had to update git which, unfortunately, was no easy feat. But with the help of this very useful guide I was able to prevail.

After downloading the latest git version for Mac I had some issues switching to the newer one. The uninstall.sh script from the installer did not help me, since I had my version of git from the Xcode command line tools. But the comments on the guide were helpful and this particular comment by pacav69 solved it for me.

Armed with the latest version of git I deleted everything and gave it another try:

git push origin master

but it was not meant to be...

 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/bbog/ideveloper-funimation.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Remember when I said selecting a license was a mistake? That option initialized my git repository with a LICENSE file which meant I had to pull it before pushing my local changes.

git pull origin master

...and I ran into another problem: I was unable to complete the merge. The terminal showed me this message:

Merge ssh://domain.com/repository.git
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts:
# the commit.

But the terminal did not seem to respond to my commands. A quick googling gave away the answer: :wq. Embarassingly, but it happens when you usually use nano to edit files and only know about vim that is a command line editor favored by hackers and old-school programmers.

Fortunately, it was the last problem I ran into.

Now my "project" is on Github. You can see the animation here: dev.bogdanbucur.eu/awesomest-projects/ideveloper or on the actual location: iDeveloper.ro.

Was it a fun ride? Maybe. Was it educational? For sure!

Git is amazing for version control and it's easy to see why so many people love it, even after running into so many problems with it today. It's just not very noob friendly.

It only takes a small thing to push you into debugging hell but once you fix everything, you are wiser and the second try will truly takes just a couple of seconds.