Git Notes

@drse / updated August 08, 2015


Check current user name/email

  • $ git config (--global) to set, add a set param at the end of cmd ... "My Name"
  • $ git config (--global) to set, as above

After switching account to organization with admin user, need to change remote origin:

  1. $ git remote -v: list remote branches
  2. $ git remote rm origin: remove the previous origin
  3. $ git remote add origin https://[email protected]/acc/git-repo.git: re-add the repo with new username
  4. $ git push -u origin master: push to new origin
  5. <enter password>

Cannot remove file that is too large from commit

remote: error: File is 200.00 MB; this exceeds GitHub's file size limit of 100.00 MB
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to ''

Go through the entire repository tree and remove that file:

$ git filter-branch --tree-filter 'rm -rf' a12345.HEAD
$ git push origin master --force

Note: a12345 is the starting range of commit log More info: