Add SSH key to a Jenkins Git step

To access a Git repository Jenkins can use an SSH key. To add the SSH key to the Jenkins server use the following Chef script Store the SSH key in an encrypted data bag called “keys”. { “id”: “ci_private_keys”, “ci_github_key”: “—–BEGIN RSA PRIVATE KEY—–\n…\n—–END RSA PRIVATE KEY—–“, }   Add the following to the Jenkins …

How to migrate the DevOps development environment to another workstation

Git Move the Git repositories to a new workstation If you want to move Git repositories to your new workstation Commit and push all repositories to GitHub on the old workstation, Copy the folders from your old workstation to the new, Execute the following command in all Git repositories on the new workstation. git reset …

How to edit the GitHub README.md file

The GitHub repositories usually contain a README.md file to describe how to use the project. The GitHub web site has a simple editor, but it has a few limitations If you accidentally refresh the page, you lose your changes, The preview pane is wider than the page that will display your file, so the formatting can be …

Permission denied message when you try to upload your new repository to GitHub from a Windows computer

If you work on a Windows computer and create a new GitHub repository, you can copy the code from the GitHub page to set the remote address and push the existing code to the GitHub server. You may get the following error message: $ git push -u origin master Permission denied (publickey). fatal: Could not …

Git configuration

If you use 2-factor authentication in GitHub,  generate a 40 character Personal Access Token that you can use as a password to access GitHub repositories. Create a Personal Access Token to use it as password in the Git client Log into GitHub and in the pull down at the upper right select Settings, On the left …

Branching and merging in Git

Branching and Merging are very powerful features in Git. There are may branching strategies, my favorite is well explained at http://nvie.com/posts/a-successful-git-branching-model/ Pick any model you like and stick to it for a while to better understand and evaluate it. If you do not like that try another one. In this model when we start to …

Merging in Git with four panels in Windows

Git is a great repository for small and large projects. It is easy to create and merge branches to separate code for the features you work on. To make merging easier you can use a free 4 panel merging tool, Perforce P4Merge. Download Download the Perforce P4Merge Visual Merge Tool from https://www.perforce.com/downloads/integrations Select the operating …

How to delete a folder from Git, but not from the local disk

I have accidentally included a folder in my Git repository, that I don’t want to include in source control. I wanted to remove it from the Git index, but not from the local hard drive. The solution is the following command git rm -r –cached myFolder If the folder name contains spaces enclose it in …