Git Notes

@drse / updated August 08, 2015

Share:  

Check current user name/email

  • $ git config (--global) user.name: to set, add a set param at the end of cmd ... user.name "My Name"
  • $ git config (--global) user.email: 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 file.zip 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 'https://github.com/...'

Go through the entire repository tree and remove that file:

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

Note: a12345 is the starting range of commit log More info: http://dalibornasevic.com/posts/2-permanently-remove-files-and-folders-from-a-git-repository