Sunday, August 16, 2015

How to resolve HTTP Request failed error, when executing a git clone.

There could be instances when we try - to download some code,using 'Git Clone' - we are prompted by a HTTP Request failed message, This happens when there is no user credentials that is missing in the git request.
Below is a sample of the failure and also how to resolve it.
[user@oc0650888602 nodetest]$ git clone https://hub.jazz.net/git/user/iotstartertrial Initialized empty Git repository in /home/user/nodetest/iotstartertrial/.git/ error: The requested URL returned error: 401 Unauthorized while accessing https://hub.jazz.net/git/user/iotstartertrial/info/refs
fatal: HTTP request failed
Fix was to enter the user credentials as shown, and it works.
git clone https://your_alias:your_IBM_ID_password@hub.jazz.net/alias/project_name.
See Sample below:

[user@oc0650888602 ~]$ git clone  https://<user>:<password>@hub.jazz.net/git/<user>/iotstartertrial  Initialized empty Git repository in /home/<user>/iotstartertrial/.git/ remote: Counting objects: 27, done remote: Finding sources: 100% (27/27) remote: Total 27 (delta 0), reused 27 (delta 0) Unpacking objects: 100% (27/27), done.

No comments:

Post a Comment