Thursday, 5 February 2015

Signing GitHub with the keychain from Mac OS X

Mac OS X comes with a feature called keychain, which allow the user to save the password into it and then, authenticate automatically.

This also works with any projects on GitHub, but it need a bit of hand work.

1. Go to your repository folder
2. Open a folder called .git
3. Open the file called config
4. Modify the protocol used for origin to ssh and add the git user to it.

e.g. this is the original code for a simple project on GitHub

[remote "origin"]
        url = https://github.com/jiahaoliuliu/MockitoTest.git
        fetch = +refs/heads/*:refs/remotes/origin/*

And this is the final result
[remote "origin"]
        url = ssh://git@github.com/jiahaoliuliu/MockitoTest.git
        fetch = +refs/heads/*:refs/remotes/origin/*

No comments:

Post a Comment