Tuesday, November 11, 2014

Git: How to clone a repository using a token on the command line

I was creating a vagrant development instance and I wanted clone from our private repository and this was something I intended to share. So, I didn't want anyone to have to log in and I didn't want to have manual steps. Since we already had a token for our group, I wanted to be able to use the token to clone and do git pulls on the development instance for all of our puppet configs. I found a solution on the web that led to the answer.


Create your token: Read up on how to create a token and create your token on github - it's easy. I used this link: https://help.github.com/articles/creating-an-access-token-for-command-line-use/

Then you can use your token to do anything it allows you. For example:

git clone --recursive https://TOKEN-GOES-HERE:x-oauth-basic@github.com/private-repo/puppet-configs.git /etc/puppet

The site that helped me was this one: 

http://rzrsharp.net/2013/07/02/private-github-repos-with-npm-and-heroku.html

No comments: