could not read Username for 'https://github.com': No such device or address could not read Username for 'https://github.com': No such device or address docker docker

could not read Username for 'https://github.com': No such device or address


To understand this error, it helps to recall that there are two ways to check out code from Github: with user name/password, and authenticating with an SSH key.

In the Github UI, the "Clone or download" button offers two options: Clone with SSH and Use HTTPS. (You might only get both options if you have added SSH keys to your Github account, I don't know). Checking out code using the https-URL requires typing your user name and password to authenticate. The SSH option creates a git@github - URL and checking out does not ask for user name and password.

I would recommend that you do not save your Github account password on the EC2 machine or in the Docker configuration. Neither would I recommend that you copy your personal id_rsa file onto the EC2 instance. Instead, create a dedicated SSH key for this purpose on Github. Give it a suitable label and decide if you want to allow pushing code or just pulling. This means you can easily revoke access later should the key get lost or if you stop using this setup.

More info about how to use the generated SSH key in the Docker setup can be found in this question:Using SSH keys inside docker container

Hope this helps :)


I had the same issue and I recently joined github but this bug is annoying me so much.I have sucessfully fixed it,

First of all Generate an SSH key and authenticate it.

Remove any previous remote address if it doesn't work, now go to your repositiory and copy the ssh clone url.

now open type the following command :

git remote add origin git@github.com:username/your-repo.git

replace username and your-repo with your username and repo.
now try to push your changes, run the following command.

git push origin master

I hope it will work for you.


Looking at the code, it doesn't look like there's an option to provide credentials, so instead I copied my id_rsa key, ran git clone, cdd into it, and ran docker build .