Failed to Publish Package: "could not read Username for 'https://github.com': Invalid argument"


#1

After successfully loging with apm login, I tried executing the following command into the package root directory:

apm publish minor

Got the following output:

Preparing and tagging a new version done
Pushing v0.1.0 tag failed
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': Invalid argument

I have been struggling for publish this package since I personally don’t use GitHub. I had to remove my original Remote from the repository and leave GitHub’s as the only Remote. After a lot of fighting I am stuck on this.

After some reading I think git on Windows could have something broken with HTTPS and stuff (nothing I could tell exactly) but when trying SSH I had also other problems.

You can check the package file on the repo.

Would anybody notice what am I missing?


#2

Is the single remote named origin? Is the default branch named master? Are you trying to publish from master?


#3

Yes. It was not before, as I said, I had other remote and stuff. But now it has only one remote origin from GitHub. And a checkout branch master which is the main GitHub branch as well (if this is how it is called). I am trying to publish from master, I guess.


#4

Are you running these commands from a bash shell on Windows? Have you tried running apm publish --tag v0.1.0 from your repository directory using the normal command prompt?


Publishing error: could not read Username
#5

I am running it from a regular Windows Command Prompt. I did now, and got: Creating new version failed: package.json invalid. Should I manually create the tag first?


#6

This latest error message is saying that there is some problem with your package.json file. That will have to be sorted first.

And yes, if the tag doesn’t exist both locally and remotely, then the apm publish --tag command I gave you won’t work.


#7

I’m having a similar problem

Linking in a similar discussion thread which seems to be on the same topic: Publishing error: could not read Username

I’m on windows, using cmd to publish a new package. I published the package initially using apm publish <nameof my package> and I got the following message:

Preparing and tagging a new version failed
npm ERR! npm version [<newversion> | major | minor | patch | premajor | preminor                                                                                               | prepatch | prerelease | from-git]
npm ERR! (run in package dir)
npm ERR! 'npm -v' or 'npm --version' to print npm version (3.10.10)
npm ERR! 'npm view <pkg> version' to view a package's published version
npm ERR! 'npm ls' to inspect current package/dependency versions

I then tried bumping the version using apm publish minor and get the following:

>>apm publish minor
Preparing and tagging a new version done
Pushing v0.5.0 tag failed
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': Invalid argument

apm version:

apm  1.18.1
npm  3.10.10
node 6.9.5 ia32
python 3.5.2
git 2.10.1.windows.1
visual studio

The package seems to have been created on atom.io: https://atom.io/packages/show-in-folder
but I would expect to see the readme there? Have not tried installing the package from atom yet.

Git repo: https://github.com/lemongrassnginger/show-in-folder


#8

Tried following the suggestion above and received:

>apm publish --tag v0.1.0
Publishing show-in-folder@v0.1.0 failed
Creating new version failed: Git tag not found

I’ve never used Git tags though so may well have missed a crucial step…


#9

One of the steps listed in the Flight Manual is to have a version of 0.0.0 in package.json. Yours reads 0.5.0.


#10

yep, that’s because I’ve tried multiple times to apm publish minor, presumably 4 times. Will try resetting it. Thanks for the tip


#11

Looks like it’s a Git credentials problem: https://github.com/atom/atom/issues/8984

Updating my remote as follows worked:

git remote set-url origin  https://<username>:<password>@github.com/<username>/<repo_name>.git