git config --global user.email "email@example.com"
git config --global user.name "username"
Command to use:
git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080
- change proxyuser to your proxy user
- change proxypwd to your proxy password
- change proxy.server.com to the URL of your proxy server
- change 8080 to the proxy port configured on your proxy server
Unset proxy:
git config --global --unset http.proxy
Print out the currently set proxy:
git config --global --get http.proxy
- Find and remove
.DS_Store
in current repo
find . -name .DS_Store -print0 | xargs -0 git rm --ignore-unmatch
- Add global .gitignore
echo ".DS_Store" >> ~/.gitignore_global
echo "._.DS_Store" >> ~/.gitignore_global
echo "**/.DS_Store" >> ~/.gitignore_global
echo "**/._.DS_Store" >> ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global
Permanently delete sentive file/folder which be uploaded accidently, ref
- Force delete file
git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch YOUR_FILE' \
--prune-empty --tag-name-filter cat -- --all
- Force delete folder
git filter-branch --force --index-filter \
'git rm -r --cached --ignore-unmatch YOUR_FOLDER' \
--prune-empty --tag-name-filter cat -- --all
- Force push to overwrite your repo
git push origin --force --all
- Undo delete
git reset --hard refs/original/refs/heads/master
- Tell your collaborators to rebase, not merge