Git

Git, and Solutions.

Permission denied (publickey)

: git push git clone

:SSH GitHub/GitLab

Solutions:

  1. SSH : ls ~/.ssh/id_*.pub
  2. : ssh-keygen -t ed25519 -C "your@email.com"
  3. GitHub: cat ~/.ssh/id_ed25519.pub → GitHub Settings → SSH Keys
  4. : ssh -T git@github.com

: SSH agent : eval $(ssh-agent) && ssh-add

CONFLICT (content): Merge conflict in <file>

: git merge git pull

:

Solutions:

  1. , <<<<<<< / ======= / >>>>>>>
  2. ,
  3. git add <file>
  4. git commit

: New,

You are in 'detached HEAD' state

: git checkout <commit-hash>

:HEAD commit

Solutions:

  1. : git checkout main
  2. : git checkout -b new-branch New
  3. : git branch new-branch git checkout new-branch

: git checkout <branch> commit hash,

! [rejected] main -> main (non-fast-forward)

: git push

:()

Solutions:

  1. : git pull --rebase origin main && git push
  2. : git fetch origin && git rebase origin/main && git push
  3. (): git push --force-with-lease

: git pull --rebase,

remote: error: File xxx is 123.45 MB; this exceeds GitHub's file size limit

: git push

:GitHub 100MB

Solutions:

  1. : git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch <file>' HEAD
  2. BFG Repo-Cleaner(): bfg --strip-blobs-bigger-than 100M
  3. Git LFS : git lfs track '*.psd'
  4. .gitignore

:.gitignore, Git LFS