git whoami


git whoami

$ git config --list

$ git config --global  --list

# quit
$ q

$ git config user.name xgqfrms
$ git config user.email xgqfrms@xgqfrms.xyz

git push bug

HTTPS bug

# https bug
$ git clone https://github.com/xgqfrms/remove-git-commit-history

# $ git clone git@github.com:xgqfrms/remove-git-commit-history.git

SSH

SSH OK

# remove-git-commit-history
$ cd /Users/xgqfrms-mbp/Documents/GitHub/

# $ git clone https://github.com/xgqfrms/remove-git-commit-history
# SSH ok
$ git clone git@github.com:xgqfrms/remove-git-commit-history.git

$ cd remove-git-commit-history

$ git filter-branch --force --index-filter "git rm --cached --ignore-unmatch tools/sensitive-data.md" --prune-empty --tag-name-filter cat -- --all

$ echo "tools/sensitive-data.md" >> .gitignore

$ git push origin --force --all

$ git push origin --force --tags

# 強制取消引用本地倉庫中的所有對象並進行垃圾回收 ???
$ git for-each-ref --format="delete %(refname)" refs/original | git update-ref --stdin
$ git reflog expire --expire=now --all
$ git gc --prune=now

從倉庫中刪除敏感數據

https://docs.github.com/cn/github/authenticating-to-github/removing-sensitive-data-from-a-repository

# ???

$ git filter-branch --force --index-filter \
  "git rm --cached --ignore-unmatch tools/sensitive-data.md" \
  --prune-empty --tag-name-filter cat -- --all
# OR 

# ???
$ cd tools
$ git filter-branch --force --index-filter \
  "git rm --cached --ignore-unmatch sensitive-data.md" \
  --prune-empty --tag-name-filter cat -- --all


git commits history 對比

https://github.com/xgqfrms/remove-git-commit-history/commits/master

before

after

SSH key

https://www.cnblogs.com/xgqfrms/p/5880270.html

SSH !== HTTPS ❌ ⚠️ bug

GitHub Desktop HTTPS bug, 要使用 SSH 通過 terminal clone 才行,

  1. HTTPS, 只能通過 GitHub Desktop 執行 git pull

https://github.com/xgqfrms/remove-git-commit-history

  1. SSH

git@github.com:xgqfrms/remove-git-commit-history.git

refs

https://alvinalexander.com/git/git-show-change-username-email-address/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM