Skip to main content

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

Comments

  1. I did this but it keeps on going back to the "local" repository. I've done a couple of changes in my local repository... created a few more branches... but it is not syncing with the remote. When I go to the github site. I see the old repo.

    The github GUI that I installed on my osx is showing the changes that I've done on local repo and asking me to sync with the github site. If I do that, the both are synced. But I need it to get working through Coda ... any ideas?

    ReplyDelete
  2. Hello Nadir,

    What is your work process? Do you commit only, see image 1? Or do you also push, see image 2?

    If you first commit, then you push to your repo, this should update the remote repository from within Coda. Unlike other tools, e.g. SourceTree where it can update/push to the remote repository at the time of the commit, with Coda it is a two step process. A commit will only update your local repo.

    Coda Commit (image 1) - http://i1.wp.com/titanfusion.net/wp-content/uploads/2013/12/coda-commit.png
    Coda Push (image 2) - http://i1.wp.com/titanfusion.net/wp-content/uploads/2013/12/coda-push.png

    ReplyDelete
  3. Hey Alexandar,

    Thanks for your reply. I figured out that Coda doesn't sync new branches created through Coda itself with remote. As you've mentioned in your reply, we have to "push" to origin in order to sync with the remote (GitHub). That works perfectly, but only for those branches that we already have on GitHub. For new branches created with Coda through dropdown menu, we have to use terminal with;
    $ git push origin newBranch

    or we have to use the GitHub app for Mac to sync all the branches and commits.

    ReplyDelete
  4. I found a way to make the authentication change without touching the config file directly. http://www.earlymarket.com/2/post/2014/02/coda-2-and-github.html.

    ReplyDelete
  5. I am still a bit confused about whether I have too many steps. User A and B each have their local repositories and we use Github for the team repository. It seems like a lot of committing, pushing and pulling. Furthermore, when one user has a conflict, the git comments end up in their local version of the file. This means that they cannot publish it to FTP in Coda. Really, only the Github origin should be published to FTP?

    ReplyDelete
  6. You are a star mate!

    ReplyDelete
  7. Ha! So that's the trick! I was wondering why it always failed to find the username... Well done, it worked awesomely!

    ReplyDelete

Post a Comment

Popular posts from this blog

Format MAC Address [JavaScript]

I am currently working on a project which will allow users to register their Wi-Fi enabled, non-web browser enabled, devices on the network. These are devices like printers, Apple TV, and Xbox*. One of the data points that have to be collected from the user is the device MAC address. The project customer wants that address to be properly formatted when they see it in the support ticket.

We have several options. We can format the address either on the back-end after the form has been submitted. Or we can format it on the front end via a separate text field for each character pair, but that is too many fields to handle. A better solution is to use a single field and format the user input at the time of input or upon submit. In those cases, the former is better because the data will already be formatted when the overall form input is being validation after the user clicks the “Submit” button.

We are going to format the user input as it is being provided, thus having proper data when vali…

SNOOZ: Sound. Sleep.

I was on the Snooz Kickstarter page today, revisiting the project’s details and timeline progress. The device, which is a white-noise generating machine, recently became available for pre-order. Snooz is meant to be an alternative to having a TV or a stationary fan running at bed time. In my case, I bought it for my wife so we can get the TV out of the bedroom.

Whilst on the comments page I read the following comment, posted recently by Ken Tran:

I'm not a fan of the new fabric design. ...
I must disagree. If you take a look at the original design, which is all plastic and no style, I must say it is fugly. It is all utilitarian - not something I rally want to look at or see when I walk into the room. The final design, seen on the right, is something that beacons to be explored, looked at, utilized.

I am a big fan of Bang & Olufsen. They use fabric from Kvadrat in their line of products. Incorporating soft materials like fabric or leather in something which is meant to be place…