Skip to content

Instantly share code, notes, and snippets.

@GGn0
Last active June 12, 2021 10:45
Show Gist options
  • Save GGn0/ba1728ec968c91eb8a5f794f5362c37f to your computer and use it in GitHub Desktop.
Save GGn0/ba1728ec968c91eb8a5f794f5362c37f to your computer and use it in GitHub Desktop.
git-notes.md

Common git problems

Added a large file in past commits and now you can't push

  • Delete the file and all its history ( source )

    git filter-branch --tree-filter "rm -f Path/to/large-file" -- --all
  • Increase the maximum file size ( source )

    git config http.postBuffer 524288000

Setup ssh key pair on vscode windows: (ref)

  • Generate key pair

    ssh-keygen -t rsa -b 4096 -C "YOUR_GITHUB_EMAIL_ADDRESS"
  • copy the public key to github/bitbucket

    clip < ~/.ssh/id_rsa.pub
  • Add the host to known hosts (example for git)

    ssh -T git@github.com
  • Actvate windows OpenSSH agent:

    • Apps & features > Manage optional features > Install OpenSSH server
    • Task manager > Services tab > right click > open services
    • Find OpenSSH Authentication Agend > set to start automatically
  • Use OpenSSH as the default agent in git

    git config --global core.sshCommand "C:/Windows/System32/OpenSSH/ssh.exe"
  • Disable authorization ineritance

    • right click on private key file
    • Security
    • Advanced
    • Disable Inheritance
    • Add yourself with full permissions
  • Add the private key to the agent

    ssh-add C:/Users/%USERNAME%/.ssh/PRIVATE_KEY_NAME
  • Setup git to use OpenSSH ssh

    git config --global core.sshCommand "C:/Windows/System32/OpenSSH/ssh.exe"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment