git免密推送代码

create a new repository on the command line

echo "# proxypool" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/xxx/proxypool.git
git push -u origin master

##需要输入账号密码

push an existing repository from the command line

git remote add origin https://github.com/xxxx/proxypool.git
git push -u origin master
##需要输入账号密码

githup免密推送

#创建仓库后获取ssh地址仓库
Clone with SSH  ----->
Use a password protected SSH key.  ---->>>>> 获取  git@github.com:xxxx/proxypool.git


##配置本机公钥到github
ssh-keygen -t rsa -b 4096 -C "uestchan@sina.com"

cat   ~/.ssh/id_rsa.pub   
复制到github
操作: 右上角-->>用户-->settings--->SSH and  GPG keys----->new  ssh  keys--->>粘贴即可.



##操作使用ssh仓库地址
git remote -v 有https的即为https方式
使用 git remote rm origin 命令移除HTTPS的方式
使用命令 git remote add origin git地址 (git地址是上面复制的内容),使用SSH方式
使用 git remote -v 命令,再次查看clone的地址,会发现git使用的方式变成了SSH方式
origin  git@github.com:xxxxxx


#################################
##1,完整操作流程(首先获取到ssh  仓库地址)
#################################


#################################
##2,配置本机公钥到github并测试
#################################
ssh -T git@github.com
Warning: Permanently added the RSA host key for IP address '52.74.223.119' to the list of known hosts.
Hi xxxx! You've successfully authenticated, but GitHub does not provide shell access.



#################################
##3,初始化本地仓库
#################################

git init
git add *
git commit -m "first commit"
git remote add origin git@github.com:xxxx/proxypool.git
git push origin master

参考:
https://blog.csdn.net/inthuixiang/article/details/79734245

原文地址:https://www.cnblogs.com/g2thend/p/12212813.html