Git clone pipeline script command error "Too Many Arguments"
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
While executing a git clone pipeline script command, one might encounter an error that displays "Too many arguments."
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
+ git clone https://$USERNAME:$PASSWORD@bitbucket.org/abc/efg.git <repo-folder>
Too many arguments.
usage: git clone [<options>] [--] <repo> [<dir>]
-v, --verbose be more verbose
-q, --quiet be more quiet
--progress force progress reporting
-n, --no-checkout don't create a checkout
--bare create a bare repository
--mirror create a mirror repository (implies bare)
-l, --local to clone from a local repository
--no-hardlinks don't use local hardlinks, always copy
-s, --shared setup as shared repository
--recursive initialize submodules in the clone
--recurse-submodules initialize submodules in the clone
--template <template-directory>
directory from which templates will be used
--reference <repo> reference repository
--dissociate use --reference only while cloning
-o, --origin <name> use <name> instead of 'origin' to track upstream
-b, --branch <branch>
checkout <branch> instead of the remote's HEAD
-u, --upload-pack <path>
path to git-upload-pack on the remote
--depth <depth> create a shallow clone of that depth
--single-branch clone only one branch, HEAD or --branch
--separate-git-dir <gitdir>
separate git dir from working tree
-c, --config <key=value>
set config inside the new repository
Cause
This error is usually associated with the credentials provided in the $USERNAME
and $PASSWORD
variables, which are often stored as a repository, workspace, or deployment variables. To resolve this issue, check if these variables contain leading or trailing spaces. Such spaces can lead to the error mentioned above.
Solution
To fix the error, make sure to remove any leading or trailing spaces from the $USERNAME
and $PASSWORD
variables and then save the corrected values. This adjustment should resolve the error and allow the Git clone pipeline script to execute successfully.
If you are encountering issues following this documentation - please raise a support ticket or a community support ticket for further assistance.
Was this helpful?