Sometimes when commanding vagrant up, you can receive this error:
==> homestead: Waiting for machine to boot. This may take a few minutes...
homestead: SSH address: 127.0.0.1:2222
homestead: SSH username: vagrant
homestead: SSH auth method: private key
homestead: Warning: Connection reset. Retrying...
homestead: Warning: Authentication failure. Retrying...
homestead: Warning: Authentication failure. Retrying...
homestead: Warning: Authentication failure. Retrying...
You can cancel this by entering CTRL+C on a Mac.
One of the ways that seems to help is doing:
vagrant ssh-config
Then, you will see the location of the IdentityFile. For example:
IdentityFile /Users/YOURNAME/Homestead/.vagrant/machines/homestead/virtualbox/private_key
You can temporarily move/backup this file. When doing a vagrant up or vagrant provision –reload, the private key will be regenerated. And it probably would work again.
Other method
You can connect directly temporarily with:
ssh vagrant@localhost -p 2222
You can then reinsert the contents of this file:
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
in the file ~/.ssh/authorized_keys
Thanks to this answer: https://stackoverflow.com/questions/22922891/vagrant-ssh-authentication-failure. You can also find more possible solutions here.
Use it all at your own risk.