Common GIT errors from VSCode

  • Update your remote URL to use SSH:
    git remote set-url origin git@github.com:USERNAME/REPO.git
    

Could not resolve hostname github.com: Name or service not known

git pull --tags origin main
ssh: Could not resolve hostname github.com: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Skip if ssh key is already configured

Test SSH Connection:

  • Open Command Prompt and run:
ssh -T git@github.com
  • This checks if your SSH setup with GitHub works correctly.

Add SSH Key to Agent:

  • Ensure your SSH key is added to the SSH agent:
ssh-add ~/.ssh/id_rsa

Replace id_rsa with your key file if it’s different.


What actually fixed the issue

Use a text editor to open C:\Users\<YourUsername>\.ssh\config and ensure it includes:

Host github.com
	Hostname github.com
	User git
	IdentityFile ~/.ssh/id_rsa

MERGE HEAD exists

When git error says:

"you have not concluded your merge (MERGE HEAD exists)

force update with this

git commit -m "Your commit message here"

Not allowed, access denied

The "do not have write permissions" issue when pushing to a GitHub repository can be caused by several factors. Here are steps you can take to troubleshoot and resolve the issue:

1. Check your Git configuration

Make sure Git is configured to use the correct user credentials:

git config --global user.name "Yohn"
git config --global user.email "user@email.com"

2. Verify your remote URL

Check if your remote URL is set correctly for the repository. You can run the following command in your terminal:

git remote -v

Look for the URL. If it uses https, ensure you are using the correct credentials. If it uses ssh, make sure your SSH key is set up correctly.