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 :)