Wednesday, April 17, 2013

Create, push, and pull a Github repository for reliability-aging project on a Snow Leopard laptop.

I created a repository on GitHub website, then download the ZIP template directory, and find out the https site. 
 
$ pwd/Users/hongqin/github/reliability_aging
$ git init
$ git add *R
$ git commit -m "first reliability commit"

$ git remote add origin https://github.com/hongqin/reliability_aging.git
$ git push --force origin master 


I then added a README on GitHub website. 
 
$ git pull origin master
From https://github.com/hongqin/reliability_aging
 * branch            master     -> FETCH_HEAD
Updating 3a05312..8b48895
error: The following untracked working tree files would be overwritten by merge:
 README.md
Please move or remove them before you can merge.
Aborting
ace:reliability_aging-master hongqin$ ls README.md 
README.md
 

This is confusing. "README.md" is pulled, but there is an error. 
 
$ git add perfect.repair.20130417.R
 
$ git commit -m "after pull error"
[master d7196bd] after pull error
 1 file changed, 2 insertions(+), 1 deletion(-)
 
$ git push origin master
To https://github.com/hongqin/reliability_aging.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/hongqin/reliability_aging.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
 
$ git push --force origin master
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 319 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
To https://github.com/hongqin/reliability_aging.git
 + 8b48895...d7196bd master -> master (forced update)
 
At GitHub site, the changes can be seen. 
 
 

No comments:

Post a Comment