1.先把本地ssh,放到gitee和github里面(查看自己的~/.ssh/id_rsa.pub,把这个放到gitee和github)
2.在本地项目中git .init初始化git
3.先添加gitee(主要是国内的快一些),git remote add origin [email protected]:this_summer/yii2-blog.git
4.再增加github,git remote set-url --add origin [email protected]:645561618/yii2-blog.git
5.查看:git remote -v
origin [email protected]:this_summer/yii2-blog.git (fetch)
origin [email protected]:this_summer/yii2-blog.git (push)
origin [email protected]:645561618/yii2-blog.git (push)
6.添加github可以直接在config里面配置,找到config文件,该文件在项目目录下的./git/config里面配置,配置如下:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = [email protected]:this_summer/yii2-blog.git
url = [email protected]:645561618/yii2-blog.git(增加这条,就可以不用操作第四条命令)
fetch = +refs/heads/*:refs/remotes/origin/*