0

I'm trying to upload nuget package to nexus from CMD on Windows. There is this command to upload file:

curl -v -u ${NEXUS_USERNAME}:${NEXUS_PASSWORD} --upload-file ${UPLOAD_FILE} http://${NEXUS_SERVER}/repository/${NEXUS_REPOSITORY}/${UPLOAD_FILE}

This works on Linux, but it didn't work on my Windows machine.

Do you know how to upload nuget file to nexus via CMD?

1 Answers1

0

Variable expansion is not done the same way in Microsoft Windows. Use the SET /? command to read more about it.

SET "NEXUS_USERNAME=joebob"
SET "NEXUS_PASSWORD=password"
...
curl -v -u %NEXUS_USERNAME%:%NEXUS_PASSWORD% --upload-file %UPLOAD_FILE% http://%NEXUS_SERVER%/repository/%NEXUS_REPOSITORY%/%UPLOAD_FILE%
lit
  • 14,456
  • 10
  • 65
  • 119
  • 1
    I didn't use variables in the CMD command, and it still didn't work. I got error 400 "multipart request required" – trytry gfdfdgd Sep 04 '19 at 13:56
  • 1
    Perhaps you will edit the question and put the command that is being used and the error message output. Change any security related information such as passwords. Text only. No screenshot graphics. – lit Sep 04 '19 at 14:53
  • Seems Nuget package not supporting restful PUT, but nuget.exe push --source '{{nexus repo}}' is OK – John Jang Aug 06 '21 at 07:40