Git Clone – Error – “fatal: Too many arguments”

Background

Ran into a little error using “”Git Bash” on MS Windows.

 

Error

Error Message – fatal: Too many arguments.

Image

Text


$ sh gitCloneShare.sh
+ IFS='$’nt’'
+ repository_=https://github.com/DanielAdeniji/sampleWork
+ folder_=sampleWork2
+ git clone h '' ps://gi hub.com/Da ielAde iji/sampleWork sampleWork2
fatal: Too many arguments.

Code


#!/bin/bash

set -x

IFS=$’\n\t’

repository_="https://github.com/DanielAdeniji/sampleWork"

folder_="sampleWork2"

git clone $repository_ $folder_

TroubleShooting

Outline

  1. Show Hidden Characters
    • Linux / GitBash
      • vi
        • show hidden characters
    • MS Windows
      • Notepad++
        • show hidden characters

Task

Git Bash

vi
Show Hidden Characters
Outline
  1. Original Plain text view
  2. Enter Command Mode and type “set list
  3. Hidden text is shown

 

Image – Before

Image – Transition to Showing Hidden Characters

Image – Show Hidden Characters

Explanation
  1. Nothing stands out

MS Windows

notepad++
Show Hidden Characters
Outline
  1. Original Plain text view
  2. Using menu access:- View / Show Symbol / Show All Characters
  3. Hidden text is shown

 

Image – Before

 

Image – Show Hidden Characters

Explanation
  1. Nothing stands out

 

Remediation

Outline

  1. IFS (  Internal Field Separator )
    • Discard
    • Replace
      • Original:- IFS=$\n\t
      • Revised:- IFS=$\n\t

Task

IFS (  Internal Field Separator )

Discard

In our particular use-case, we do not need to override the IFS.

And, so we are very well served if we just discard it.

 

Replace

For those who believe in preserving code copied from elsewhere, please use it well.

original

revised

Explanation

Please make sure that you use proper quotes.

In this case, single quotes (‘) or double-quotes will suffice.

 

References

  1. Chrispian H. Burks
    • Quick vi tip: Show Hidden Characters
      Link

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s