开发者

Automate Login in Shell Script

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜