ssh-keygen -t rsa -C "you@email.com"
输入文件名,完成创建。
打开 ~/.ssh/config,添加如下的文件
Host your_host
HostName example.com
RSAAuthentication yes
IdentityFile ~/.ssh/your_rsa_file
User git
将你的公钥文件(后缀名为.pub)导入到服务器中(服务器会将其添加到 authorized_keys 文件中)
首先使用 git remote -v 找到自己原来的远程仓库,例如 github.com/phpcyy/first.git。
在自己的目录中输入以下命令完成换源
git remote set-url origin your_host:/phpcyy/first.git
从此之后使用 git 命令再也不用输入密码了
暂时没有留言