每次提交代码时需要输入用户名密码,则说明你在从仓库中clone代码时使用的是HTTPs的key进行拉取代码。
而是用SSH key拉取代码时,则不需要。下面是进行SSH key配置
1
1、在git bash命令行中输入
$ ls -al ~/.ssh
检查电脑中是否已经存在SSH key
2、创建一个新的SSH key
$ ssh-keygen -t rsa -C "your_email@example.com"
Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
输入密码
Enter passphrase (empty for no passphrase): [Type a passphrase]
# Enter same passphrase again: [Type passphrase again]
3、Add your key to the ssh-agent
$ ssh-agent -s
$ ssh-add ~/.ssh/id_rsa
在github profile 中有个add ssh key 将文件中的内容拷贝添加一个 key