Unable to Push changes to GitHub via Visual Studio Code
On Windows, Visual Studio Code uses the Private key from .ssh folder to push files to github online repository.
Typically developers use id_rsa as private key and its copied under c:\users\<username>\.ssh folder.
However, when install Git CLI for windows it “may” map your HOME folder to another drive or folder which may cause your GIT push / pull to fail.
How to fix this authentication error ?
Method 1 : Copy the id_rsa to folder which is pointed by $HOME folder pointed by Git BASH.
- Simple to do.
- May have to copy the private key multiple locations.
Method 2 : Change the HOME variable by modifying the variable under Git BASH $ HOME=/c/Users/$USERNAME
- If you want to avoid copying private key to multiple folders each time.
- You have to set this each time when GIT BASH is evoked or make changes in .bashrc file.
Method 3 : Change the HOME variable at Environment level (Windows) and change it to HOME=c:\Users\%USERNAME%
- Permanent & clean solution.
- But need Admin privileges on windows host.