git
protocol error
HTTP
troubleshooting
version control

git fatal I don't handle protocol '​​http'

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Introduction

The error fatal: I don't handle protocol '​​http' (or '​​https') occurs when a Git URL contains invisible Unicode characters — typically zero-width spaces (U+200B) or non-breaking spaces — that look like normal characters but are not. This commonly happens when copying URLs from web pages, chat applications, word processors, or documentation that use rich text formatting.

The Cause

The error is almost always caused by invisible characters in the URL. What appears as https://github.com/user/repo.git actually contains hidden characters:

bash
1# What you see:
2git clone https://github.com/user/repo.git
3
4# What Git receives (with invisible zero-width spaces):
5git clone ​​https://github.com/user/repo.git
6#          ^^ two zero-width spaces (U+200B) before "https"

Git parses the protocol as ​​https (with hidden characters) instead of https, does not recognize it, and throws the error.

Fix 1: Retype the URL Manually

The most reliable fix is to delete the URL and type it by hand instead of pasting:

bash
# Delete the pasted URL and type it manually
git clone https://github.com/user/repo.git

Do not copy and paste — type the URL character by character.

Fix 2: Strip Invisible Characters

Use sed or tr to remove non-printable characters from the clipboard:

bash
1# On macOS — clean the clipboard, then paste
2pbpaste | sed 's/[^[:print:]]//g' | pbcopy
3
4# Then paste the cleaned URL
5git clone $(pbpaste)
bash
# On Linux (with xclip)
xclip -selection clipboard -o | sed 's/[^[:print:]]//g' | xclip -selection clipboard

Fix 3: Use a Hex Editor to Identify Hidden Characters

Inspect the URL for invisible characters:

bash
1# Show hex dump of the URL
2echo -n "​​https://github.com/user/repo.git" | xxd | head
3# 00000000: e280 8be2 808b 6874 7470 733a 2f2f 6769  ......https://gi
4#           ^^^^^^^^^^^^^^^^ these are the zero-width spaces (E2 80 8B)
bash
# Using cat with special character display
echo -n "​​https://github.com/user/repo.git" | cat -A
# Shows non-printing characters as escape sequences
bash
1# Using Python to inspect
2python3 -c "url='​​https://github.com/user/repo.git'; print([hex(ord(c)) for c in url[:10]])"
3# ['0x200b', '0x200b', '0x68', '0x74', '0x74', '0x70', '0x73', '0x3a', '0x2f', '0x2f']
4# 0x200b = zero-width space

Fix 4: Remove Specific Unicode Characters

bash
# Remove zero-width spaces from a git remote URL
git remote set-url origin "$(git remote get-url origin | sed $'s/\xe2\x80\x8b//g')"

Common Invisible Characters That Cause This

CharacterUnicodeNameCommon Source
U+200BZero-width spaceWeb pages, chat apps
U+200CZero-width non-joinerRich text editors
U+200DZero-width joinerEmoji sequences
U+00A0Non-breaking spaceWord processors, web pages
U+2003Em spaceTypography tools
U+FEFFByte order markText file headers

Where These Characters Come From

  • Slack, Teams, Discord: Chat applications use rich text that may insert zero-width characters for formatting
  • Confluence, Notion, Google Docs: Wiki and documentation tools insert invisible formatting characters
  • Stack Overflow, blog posts: Code blocks on websites sometimes include hidden characters from the CMS
  • Email: HTML emails frequently contain non-breaking spaces and other formatting characters
  • PDFs: Copying text from PDFs often introduces invisible characters

Preventing the Issue

Use Raw/Plain Text When Copying

bash
1# Clone directly from the terminal URL bar
2# or use the GitHub CLI
3gh repo clone user/repo
4
5# Copy the URL from GitHub's "Code" button — it provides clean URLs

Configure Your Editor

Many editors can display invisible characters:

  • VS Code: "editor.renderControlCharacters": true
  • Vim: :set list shows invisible characters
  • Sublime Text: Use the "Show Control Characters" package

Verify Before Cloning

bash
1# Test the URL with curl first
2curl -I https://github.com/user/repo.git
3
4# If curl fails with a protocol error, the URL has hidden characters

Other Protocol Errors

The same I don't handle protocol error can also occur with:

bash
1# Wrong protocol specification
2git clone htp://github.com/repo.git      # Typo: htp instead of http
3git clone http//github.com/repo.git      # Missing colon
4git clone ftp://github.com/repo.git      # FTP not supported by default
5
6# Fix: use correct protocol
7git clone https://github.com/user/repo.git
8git clone [email protected]:user/repo.git

Common Pitfalls

  • Invisible characters look identical to clean text: You cannot see the problem by looking at the URL. Use xxd or cat -A to reveal hidden characters.
  • Multiple paste attempts: Each paste from the same source inserts the same hidden characters. Retyping manually is the only reliable fix.
  • Remote URL contamination: If you set a remote URL with hidden characters (git remote add origin <pasted-url>), every push/pull will fail. Fix with git remote set-url origin <clean-url>.
  • Git config files: If a URL with hidden characters ends up in .git/config, edit the file directly to clean it.
  • SSH URLs: This error does not occur with SSH URLs ([email protected]:user/repo.git) because they use a different protocol format. Consider using SSH if you repeatedly encounter this issue.

Summary

  • fatal: I don't handle protocol is caused by invisible Unicode characters (usually zero-width spaces) in the URL
  • The fix is to retype the URL manually instead of pasting from a rich text source
  • Use xxd or cat -A to inspect URLs for hidden characters
  • Common sources: Slack, Confluence, Stack Overflow, emails, and PDFs
  • Use gh repo clone or SSH URLs to avoid the issue entirely

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.