Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

issue running script on gitbash

Avatar

Level 8

I want to remove some node for so many pages.

I executed the below command on cmnd prompt it successfully deleted the node 
curl -insecure -u aem-admin :u69naiqt -X DELETE https://author-yps.adobecqms.net/content/products/zh-cn/compressors/products/Air-compressor/oil-free...

 

But when I execute same command using gitbash its throwing 401 unauthorized response
HTTP/1.1 401 Unauthorized Date: Tue, 30 Apr 2024 01:11:11 GMT Server: Apache X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1 X-Content-Type-Options: nosniff Content-Security-Policy: default-src 'self'; script-src https: 'self' 'unsafe-inline' 'unsafe-eval' 'wasm-unsafe-eval' https://cdn.jsdelivr.net/npm/ blob:; style-src 'self' 'unsafe-inline' https:; img-src https: data: blob: 'self'; media-src https: 'self'; object-src 'self'; font-src *.gstatic.com *.googleapis.com data: 'self' https:; frame-ancestors https://*.hubspot.com https://info.atlascopco.us https://info.atlascopcoupdates.com http://*.scene7.com https://atlascopco-preview.adobecqms.net 'self'; frame-src https:; connect-src https: 'self'; worker-src blob:; child-src blob: Referrer-Policy: no-referrer-when-downgrade Feature-Policy: accelerometer 'none'; ambient-light-sensor 'none'; autoplay *; camera 'none'; display-capture 'none'; display-capture 'none'; document-domain 'none'; encrypted-media 'none'; fullscreen *; geolocation *; gyroscope 'none'; layout-animations 'none'; legacy-image-formats 'none'; magnetometer 'none'; midi 'none'; oversized-images 'none'; payment 'none'; picture-in-picture 'none'; speaker *; sync-xhr *; unoptimized-images 'none'; unsized-media *; usb 'none'; vibrate 'none'; vr 'none'; webauthn 'none' WWW-Authenticate: Basic realm="Sling (Development)" Vary: User-Agent Content-Length: 0


Can anyone tell why it was happening. I want remove some node for so many pages 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Vani1012 ,

The 401 Unauthorized response typically means that the credentials provided for authentication are incorrect or missing. The fact that it worked in the command prompt but not in Git Bash suggests that there might be an issue with how Git Bash handles the authentication or the credentials themselves.

Here are a few things you can try to troubleshoot the issue:

  1. Check Credential Format: Make sure that the credentials (aem-admin:u69naiqt) are correctly formatted and don't contain any extra spaces or special characters.

  2. Enclose Credentials in Quotes: Sometimes Git Bash can interpret certain characters differently. Try enclosing the username and password in quotes like this: curl -insecure -u "aem-admin:u69naiqt" -X DELETE https://author-yps.adobecqms.net/content/products/zh-cn/compressors/products/Air-compressor/oil-free....

  3. Test with Basic Authentication Header: Instead of using -u, you can manually set the Basic Authentication header in the request. Try the following command:

 

curl -insecure -X DELETE -H "Authorization: Basic $(echo -n 'aem-admin:u69naiqt' | base64)" https://author-yps.adobecqms.net/content/products/zh-cn/compressors/products/Air-compressor/oil-free...

 

    1. Verify Credentials: Double-check that the credentials (aem-admin and u69naiqt) are correct and have the necessary permissions to perform the delete operation.

    2. Check for Proxy or Firewall Issues: Ensure that there are no proxy or firewall settings in Git Bash that might be interfering with the request.

    3. Debugging: You can use the -v flag with curl to enable verbose mode and see more detailed information about the request and response. This might provide additional insights into the issue.

    By trying these steps, you should be able to identify and resolve the authentication issue in Git Bash and successfully execute the delete operation on your AEM instance.

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @Vani1012 ,

The 401 Unauthorized response typically means that the credentials provided for authentication are incorrect or missing. The fact that it worked in the command prompt but not in Git Bash suggests that there might be an issue with how Git Bash handles the authentication or the credentials themselves.

Here are a few things you can try to troubleshoot the issue:

  1. Check Credential Format: Make sure that the credentials (aem-admin:u69naiqt) are correctly formatted and don't contain any extra spaces or special characters.

  2. Enclose Credentials in Quotes: Sometimes Git Bash can interpret certain characters differently. Try enclosing the username and password in quotes like this: curl -insecure -u "aem-admin:u69naiqt" -X DELETE https://author-yps.adobecqms.net/content/products/zh-cn/compressors/products/Air-compressor/oil-free....

  3. Test with Basic Authentication Header: Instead of using -u, you can manually set the Basic Authentication header in the request. Try the following command:

 

curl -insecure -X DELETE -H "Authorization: Basic $(echo -n 'aem-admin:u69naiqt' | base64)" https://author-yps.adobecqms.net/content/products/zh-cn/compressors/products/Air-compressor/oil-free...

 

    1. Verify Credentials: Double-check that the credentials (aem-admin and u69naiqt) are correct and have the necessary permissions to perform the delete operation.

    2. Check for Proxy or Firewall Issues: Ensure that there are no proxy or firewall settings in Git Bash that might be interfering with the request.

    3. Debugging: You can use the -v flag with curl to enable verbose mode and see more detailed information about the request and response. This might provide additional insights into the issue.

    By trying these steps, you should be able to identify and resolve the authentication issue in Git Bash and successfully execute the delete operation on your AEM instance.

Avatar

Community Advisor

@Vani1012  We can clearly see from the command that we are getting '401 Unauthorized' that means username and password are wrong. I tried a simple curl in my local and it's working fine. Below is the curl command

 

curl -u admin:admin -X DELETE http://localhost:4502/content/yourProject/yourNode

Avatar

Community Advisor

Hi @Vani1012 , I can see from your command there is a space between username:password which might causes the unauthorized issue.

 

Please refer https://experienceleague.adobe.com/en/docs/experience-manager-65/content/sites/administering/operati...