Git远程仓库

远程仓库

远程仓库    git remote add(把本地已有的仓库关联到远程仓库上,像github上)-->git pull(github文件变更到本地仓库里)-->git push(本地仓库的东西推到远程仓库上去)-->git clone(将远程仓库克隆到本地,这样就不需要git init来初始化本地仓库)

git remote add origin git@github.com:yayademo/demo.get
git pull origin master --allow-unrelated-histories
git push -u origin master
git clone git@github.com:yayademo/yaya_demo.git

1、GitHub先注册一个账号

2、创建SSH Key

因为本地的git库与github仓库传输是通过SSH加密传输的

ssh-keygen -t rsa -C "example@sina.com"       此处邮箱是注册github账号的那个邮箱

github用的key是公钥

如果提交后没有成功,可能是Key行末尾有空格

查看本地有没有和github联通:ssh -T git@github.com

3、添加远程仓库

 点击下方的Creating repository后,出现下方页面

可以按上方命令练习下

可以看到自己提交的

 

 克隆仓库

标签管理
查看所有标签  git tag
创建标签  git tag name
指定提交信息  git tag -a name -m "comment"
删除标签  git tag -d name
标签发布  git push origin name

原文地址:https://www.cnblogs.com/peiya/p/12748096.html