I want to create an automate login for github push to repository script in mac terminal. But I met some problem with login issue, like it will ask for username and password, so what command that can automatically insert username when it ask for username same with password?
I found ‘expect’ command in Linux, but the way of using is different in Mac terminal.
Lunayos-MacBook-Pro:SuperDeals-iPhone Lunayo$ git push origin
Everything up-to-date
Lunayos-MacBook-Pro:SuperDeals-iPhone Lunayo$ git push upstream
Username:
You should refer to GitHub’s excellent help articles:
You need to either generate an SSH key with no passphrase (or start ssh-agent before you use your script if you would like to use a passphrase); otherwise, OpenSSH will ask for a password or passphrase.
Also ensure that your remote URL looks like
ssh://git@github.com/user/repo.gitorgit@github.com:user/repo.git. Specifically, thegit@part tells Git and OpenSSH that you want to make the SSH connection using the usernamegit(which is correct for all GitHub repositories).