Repository navigation
Gotchas
Eclipse + Git + newbies = pain
Something that really hung us up for a few days was git+eclipse issues when more than one person was contributing to the repository. Being that Java is a compiled language, and Eclipse is "helpful", we were ending up with system-specific binaries compiled into the workspace folder, and getting inadvertently committed to the github repository. Then when we pulled the repository from another machine, Eclipse would got bonkers about these binary files not matching, and fail to pull the new code. At the time, the best solution we had was to nuke the local repository and do a full pull from the repo again. This was less than optimal.
So, the solution was: delete the binary files from the github repository so Eclipse would stop trying to pull them in, and prevent them from being added back to the repository. Knowing little about how git works, this took way longer to figure out than it should have, but here's the short and sweet answer:
- Add an alias for the repo to make life a little easier:
all3vil@pancake:~/github$ git remote add ptt https://github.com/androidpttadvisor/androidpttadvisor.git
- Do a fresh pull
all3vil@pancake:~/github$ git pull ptt HEAD
- Remove the offending files that you want out of the repository
all3vil@pancake:~/github$ rm AndroidPTTAdvisor/bin/resources.ap_
- Commit, telling git to remove files from the repo that you don't have locally
[master 0ffad6f] Trying to remove binary files.
2 files changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 AndroidPTTAdvisor/bin/classes.dex
delete mode 100644 AndroidPTTAdvisor/bin/resources.ap_
all3vil@pancake:~/github$
- Push your local repo to github:
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
error: git-credential-osxkeychain died of signal 11
Username for 'https://github.com': all3vil
Password for 'https://all3vil@github.com':
error: git-credential-osxkeychain died of signal 11
Counting objects: 328, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (94/94), done.
Writing objects: 100% (298/298), 1.33 MiB | 181 KiB/s, done.
Total 298 (delta 128), reused 258 (delta 122)
To https://github.com/androidpttadvisor/androidpttadvisor.git
2a9a5e9..0ffad6f master -> master
all3vil@pancake:~/github$
And poof the binary files are gone from github's repo (though they still exist in the repository's history, in case you nuke something you shouldn't). And then there's the part about not committing these files any more. To do that, we use the .gitignore file. We've implemented this one, which includes a bunch of the crap-files that Eclipse generates but that you do not want in your repository. To add the .gitignore to the repository, I did this:
all3vil@pancake:~/github/AndroidPTTAdvisor$ vim .gitignore
all3vil@pancake:~/github/AndroidPTTAdvisor$ git add .gitignore
all3vil@pancake:~/github/AndroidPTTAdvisor$ cd ..
all3vil@pancake:~/github$ git commit
[master 2c79905] Added .gitignore to skip files that break imports (binaries and system-specific build files and such)
1 file changed, 29 insertions(+)
create mode 100644 AndroidPTTAdvisor/.gitignore
all3vil@pancake:~/github$ git push ptt
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
error: git-credential-osxkeychain died of signal 11
Username for 'https://github.com': all3vil
Password for 'https://all3vil@github.com':
error: git-credential-osxkeychain died of signal 11
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 569 bytes, done.
Total 4 (delta 1), reused 0 (delta 0)
To https://github.com/androidpttadvisor/androidpttadvisor.git
0ffad6f..2c79905 master -> master
all3vil@pancake:~/github$