Git journey

Blog Post created by Gregg_Stewart Employee on Jul 31, 2015

In my last blog post I outlined some automation tasks I was interested in moving forward with. I had made progress in some of the customization's needed for the log analysis (ELK). But I have since postponed working on that project to complete setting up a Chef environment. I had been wanting to setup a chef environment for a while. In part because of the integration that CA Release Automation has for it. But also because I found myself getting to a point in my ELK customization work where I might want to begin utilizing maven and other development tools. In addition to these two motivational factors I wanted to begin migrating some of my software installations, currently defined in CA Server Automation "Applications" and "Service Templates", to chef. Or at least not write any new "Applications" in CA Server Auto but instead within Chef. CA Server Automation Self Service Portal has been great and I probably wouldn't completely replace all of the Applications. But there are times when I would like to easily install various components after a server has already been provisioned. And I feel Chef is a better fit for these things.

So... how did we get from all of that to "Git journey"? Well, once I began investigating Chef I realized and learned a few things such as:

  • There is a tool chef-solo and/or chef-zero available that seems like it can utilize the same cookbooks designed to be used by chef-server. In this case, I'll probably use git so that the provisioned systems install chefdk, pull the chef-repo from git, and install various components without involving the chef server.
  • I thought that I would use Git as a place to backup the chef-server related repo data.
  • After reading various cookbook development articles I learned that it is good practice to treat your cookbooks as any other source file that you want to version.
  • Plus, it makes since to store the customization work that I'm doing for the log analysis piece in Git.

Along in my git journey I found a couple of helpful resources. So far I found:


Here are some of the challenges I've had so far with Git:

  • A local git repo can be anywhere on your machine. and it appears that they are configured - or not - with certain settings. I don't know the commands to figure out all of the existing configs. But it looks like it is tracked via the .git/config file.
  • I've seen terms like origin, master, Head, index, etc.. that I don't fully understand yet.
  • I've experienced 403 errors when doing a git push -u origin master. This was resolved by updating my .git/config so that my remote "origin" section's url was set to use:
    • https://<user>:<password>@github...url/orgName/repoName.git
    • But there is no way that I'll do this on a permanent basis. I'm not sure why it didn't prompt for user/password but if I can't figure that out then i'll look into using different git push commands. I've seen something about https vs ssh and I've also seen something about Git - git-credential-store Documentation but even the credential-store documentation says that it stores the info in a file that is not encrypted and only secured based on user permission access.
  • I made one branch (master) and 1 tag (default-repo). The default-repo tag is a clone of and the master branch is default-repo + a cookbook/maven folder (which I grabbed from Welcome - The resource for Chef cookbooks - Chef Supermarket). But then I realized that the that included text at the very top saying that it was deprecated and recommended using the "chef generate repo" command. So now I wanted to update both my master branch and my default-repo tag so that it used this as its base.
    • I first focused on getting just a copy of the tagged repo which wasn't working out so I found this post on stackoverflow - explaining how git clone will give you the whole repository and that after the clone you would need to run 'git checkout tags/<tag name>'. I confirmed that the directory structure was the same as the default-repo tag.
    • Then I updated the directory contents with the chef-repo from chefdk. But I have had problems getting it to the remote git server. I'm still not entirely sure how to do this. Based on some articles I've seen so far it looks like I might need to rebase something or other. While mentioning some of this to Adam Lewandowski he pointed out that Git has a UI tool that can be used to more easily manage local repositories. I think I'll give that a try.