Changing your git client password to github.com on OS X / adding Personal Access Token for git client

Just ran into this as I had changed my account password a few days back, and the approach to change your password for your git client on OS X is not that obvious. At the same time I enabled Two Factor Authentication for my github account. When using with a command-line git client, this also requires generating a Personal Access Token and passing it with your authentication.

Instructions in this post here – you need to change your password in the Keychain Access app.

Create a Personal Access Token following steps here.

Next, when adding a remote for the repo, pass the token like this:

git remote add github https://github-id:access-token@github.com/path-to/remote-repo.git

Now when you push to the remote repo, you’ll be authenticated with your token, and should be all set.

 

Merging a new OpenShift project git repo with an existing local project repo

Steps mainly from here, assuming you already have a local git repo for an existing project and you want to merge it into a newly created project on OpenShift for deployment:

Add the remote openshift remote:

git remote add openshift_git_repo_url

Merge the content from the newly created repo into your existing project (this will be some pom.xml changes and the .openshift directory for remote server settings and triggers etc):

git merge openshift/master -s recursive -X ours

This didn’t do anything for me, it said ‘already up to date’, so I pulled down the files from the remote with:

git pull openshift master

which resulted in a couple of conflicts, like pom.xml. Update the files with conflicts to resolve them and commit the changes, then push back to the remote:

git push openshift master

Done!