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-iPh开发者_高级运维one Lunayo$ git push upstream
Username:
You should refer to GitHub's excellent help articles:
- Set Up Git
- SSH key passphrases
- Remotes
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.git
or git@github.com:user/repo.git
. Specifically, the git@
part tells Git and OpenSSH that you want to make the SSH connection using the username git
(which is correct for all GitHub repositories).
精彩评论