1、添加一个新的远程仓库:git remote add [shortname] [url]
如:git remote add origin GitHub - CodingLS/black
2、生成SSH Key:ssh-keygen -t rsa -C "2909461389@qq.com",之后一直默认操作,如下图:
按指定目录生成示例:ssh-keygen -t rsa -f C:\\Users\\admin\\.ssh\\id_rsa_github -C "2909461389@qq.com"
查看生成的ssh key:cat ~/.ssh/id_rsa.pub 如下图:
4、测试是否成功连接远程github:ssh -T git@github.com
echo "# black" >> README.md git init git add README.md git commit -m "first commit" git remote add origin https://github.com/CodingLS/black.git git push -u origin master
git remote add origin https://github.com/CodingLS/black.git git push -u origin master
git remote 或 git remote -v( -v 参数,你还可以看到每个别名的实际链接地址)