How to setup Coda 2 to push to GitHub?

Setting up a new site in Coda 2 and cloning a GitHub remote repository is not that big of a deal. Where you will most likely run into problems is when you try to push your changes to the GitHub remote repository. Below I will show you how to update the Git config file in your local repository so you do not run into one of the following errors:
  1. git push failed remote: Remote anonymous access to repository denied
  2. git push origin master Username: fatal: Could not read password
The GitHub repository address I am going to use is that of Source Code DNA: https://github.com/thetitan/sourcecodedna.git. I will assume that you have already setup your Coda 2 site profile and cloned your repository, you have made some changes, and now you are ready to push those changes to your projects GitHub repo.

git push failed remote: Remote anonymous access to repository denied


The first error message you will encounter on your first try to push. This is because the target URI is just an address, there is no account username in it to authenticate with. To resolve this we will prepend the GitHub account username. In my case it is thetitan. So the target URI will become https://thetitan@github.com/thetitan/sourcecodedna.git. Now Git has a username to authenticate with.
Git config file without site username.

This change will be made in the git config file of your local project directory. To edit the file execute the following command "vi ~/path to project directory/.git/config". Since the local repository directory is hidden you will have to do this in the terminal app. Remember to replace the "path to project directory" with your local directory hierarchy.
Site Git config file - username in URI.

git push origin master Username: fatal: Could not read password


The second error message is caused by the changes we made to the target URI when we added the username. Because the remote repository address was changed to include a login username there is no associated password with it in the keychain, anymore. To fix this we will have to update the Coda site SCM (source tab) configuration. All you have to do is select the remote repo from the drop down, the default name is "origin", and add your GitHub account password.
Coda SCM setup

Popular posts from this blog

Validate Email Address [JavaScript]

SNOOZ: Sound. Sleep.

Messing with WordPress SPAM Bots