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
免密传输代码
#创建仓库后获取ssh地址仓库
Clone with SSH
Use a password protected SSH key.
[email protected]:xxxx/proxypool.git
##配置本机公钥到github
cat ~/.ssh/id_rsa.pub
复制到github 用户settings--->SSH and GPG keys----->new ssh keys
粘贴即可.
##操作使用ssh仓库地址
使用 git remote rm origin 命令移除HTTPS的方式
使用命令 git remote add origin git地址 (git地址是上面复制的内容),新添加上SSH方式
使用 git remote -v 命令,再次查看clone的地址,会发现git使用的方式变成了SSH方式
#################################
##1,完整操作流程(首先获取到ssh 仓库地址)
#################################
#################################
##2,配置本机公钥到github并测试
#################################
ssh -T [email protected]
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 [email protected]:xxxx/proxypool.git
git push origin master
参考:
https://blog.csdn.net/inthuixiang/article/details/79734245
原文地址:https://www.cnblogs.com/g2thend/p/12212813.html
时间: 2024-10-15 07:51:53