I'm trying clone a repository with http using the username and password lik e this:
git clone https://username:[email protected]/user/repo.git
However I get this error:
fatal: unable to access 'https://username:[email protected]/user/repo.git': Illegal port number
I'm trying to do this on a EC2 Instance that is using AWS Linux. I can get this working if I do it manually, and use only the username in the clone and then put the password to the prompt, but I'm trying to clone the repository with a bash script.
The native git transport uses TCP port 9418. However, git can also run over ssh (often used for pushing), http, https, and less often others. You can look at the repository URL to find out which port it uses.
When the repository to clone from is on a local machine, this flag bypasses the normal "Git aware" transport mechanism and clones the repository by making a copy of HEAD and everything under objects and refs directories. The files under .git/objects/ directory are hardlinked to save space when possible.
See the git fetch manpage for more details on the available URL schemes. Git uses port 9418. You can view connections using that port with. Open 9418 and your traffic will pass through the firewall. I've also found that the outbound SSH port 22 might need to be open as well as port 9418 for Git (both TCP).
When the repository to clone from is on a local machine, this flag bypasses the normal "Git aware" transport mechanism and clones the repository by making a copy of HEAD and everything under objects and refs directories.
With Charles' comments I figured out the reason why this error occurred. The password contained a %-character and a 4-character, which is the URL Encoded value of @-character. This caused it treat it as a proxy password (if I understood correctly.. basically the solution here.)
So what I did was I changed the password, and now it works just fine!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With