Creating the Perfect Web Development Workflow

I am following a tutorial online to create a perfect workflow for developing. Basically, I make local changes, commit them with git, push them to the remote git repo, and my website automatically pulls the updates.–net-19564

I got stuck on step 2 trying to run the command “git push -u origin master”. The problem was with the files in my ~/.ssh folder. Git Bash was reading the wrong file. I had to follow the instructions below to get “git push -u origin master” to work.

I ran into problems with SSH, but following a git tutorial on creating ssh keys, I was able to make it work. I followed steps 1-5. All are necessary. The only difference is that in step 2.2, I had to give the file a different name. instead of hitting “enter” and having it save to ~/.ssh/id_rsa, I entered a different file, and the two files got saved in my current directory. I just cut and pasted them into ~/.ssh. Also, when trying to turn on ssh-agent, I got an error, but this post on stackoverflow helped me.

Stuck. In step 3, I tried to SSH too many times (once?) with the wrong info into my website. It’s now blocking me from even connecting. This happened before. I can try, again, on a different wifi network. It takes a couple  days to reset.

It stinks that the settings have to be different for every hosting provider (different port number, etc). That makes it SSHing tough.

Success! This article on stackoverflow helped me out a lot. Running this very long, complicated command in Git Bash worked: ssh -o IdentitiesOnly=yes -i ~/.ssh/name_of_key_file -l cpanelusername -p 2222

The -i flag tells Git Bash which key file in ~/.ssh to use. We created the key files above. Why SSH is even looking at those files or why using one file over another would work is beyond me, but it worked. The port is specific to host gator’s shared hosting sites.

Stuck. In step 3, I tried running the command “git clone” but I got the error “Permission denied (publickey).”

Problem solved. I’m sure there’s an easier way, but I generated some more keys by first sshing into and then following the the same git tutorial on creating ssh keys as before. There is also a ~/.ssh directory that holds id_rsa and files that github reads to see if you have permission to copy something from one of its repos. Very confusing.

Anyway, I successfully ran the command “git clone” but the only problem is that it created a file called myexamplegitrepo inside of myhomedirectory like this: myhomefolder/myexamplegitrepo. I remedied this by renaming myexamplegitrepo to myhomefolder, changing the name of the home folder to myoriginalhomefolder, so I had: myoriginalhomefolder/myhomefolder. Then I just took myhomefolder out of myoriginalhomefolder, and wala.

Well, I got through all the steps, but, now, I can’t seem to get the very last step to work. This was definitely not an easy process.

Yeah, I can’t seem to get the last step to work, but, regardless, being able to push to a repo on github and pull it from my host’s server is very helpful. I’ll create a new, more organized post explaining all the steps I went through because I went through a LOT more steps than the editor of the article did.