起因
centos 下 git到 github仓
首先
- 下载git
yum install git -y 配置git
git config --global user.name "Your Name"#new namegit config --global user.email "email@example.com"#new emailgit config --list#查看配置信息创建本地仓库:
mkdir gitspace
cd gitspacegit init#将当前目录变成git仓库添加
touch README.mdgit add README.mdgit commit -m"first upload"git status#查看状态配置私钥
本地生成私钥ssh-keygen -t rsa -C "your_email@youremail.com"#连按三个回车
cat /root/.ssh/id_rsa.pub #查看私钥 并复制
把本地生成的私钥 设置到github
在settings设置ssh key
记得下面打勾✔ 允许读取权限
- 执行github命令
git remote add origin xxx#给本地仓库加一个远程的仓库git push -u origin master#把本地仓库推送到远上面这个远程仓库的 master分支
参考:
https://www.cnblogs.com/daniaofighter/p/9452661.html
https://www.jianshu.com/p/4f3bbc566e76
https://www.jianshu.com/p/2779b5d6a59a
来源:https://www.cnblogs.com/unixcs/p/12306013.html
