Sunday, July 19, 2015

Git Moving Day

Hello again.  Today I moved the code from google to github.  Google made it really easy, they gave me an easy button.  All I had to do was create an account on github and then press the easy button.

I also have a different laptop than I was using before, so I installed the git bash software, configured it and cloned the code repository.  Instead of using the .netrc method of storing the credentials like I did last time, I used the credential helper feature of git.  I must have missed it last time around, why didn't you tell me? 

You just need to configure git to use a credential helper, then the first time you try to push to a host, git asks for and saves the credentials.

This post is just a nice place to remember the git stuffs.

Configure global git user info and default to simple pushes:

$ git config --global user.name "{UserName}"
$ git config --global user.email "{Email}"
$ git config --global push.default simple


See available credential helpers, use wincred:
 
$ git help -a | grep credential-*
  credential          merge-recursive     stage
  credential-store    merge-resolve       stash
  credential-wincred  merge-subtree       status

$ git config --global credential.helper wincred


Clone repo from github to local:
 
$ cd git
$ git clone https://github.com/RealNoArms/no-arms-darts.git


Test commits and pushes, one time credentials entry:

$ mkdir Test
$ cd Test
$ vi test.txt
$ cd ..
$ git add Test
$ git commit -m "Testing github configuration"
[master e968e9f] Testing github configuration
 1 file changed, 2 insertions(+)
 create mode 100644 Test/test.txt
$ git push
Username for 'https://github.com': RealNoArms
Password for 'https://RealNoArms@github.com':
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 329 bytes | 0 bytes/s, done.
Total 4 (delta 1), reused 0 (delta 0)
To
https://github.com/RealNoArms/no-arms-darts.git
   c4f0097..e968e9f  master -> master
$ cd Test
$ vi test.txt
$ git commit -a -m "Testing github configuration part2"
$ git push
Counting objects: 8, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 326 bytes | 0 bytes/s, done.
Total 4 (delta 1), reused 0 (delta 0)
To
https://github.com/RealNoArms/no-arms-darts.git
   e968e9f..644ca58  master -> master
$ cd ..
$ git rm -r Test
rm 'Test/test.txt'
$ git commit -m "Remove github config test files"
[master 3a98162] Remove github config test files
 1 file changed, 3 deletions(-)
 delete mode 100644 Test/test.txt


OK.  Now maybe I'll try to work on the project some more.

No comments:

Post a Comment