git远程仓库
git远程仓库衍生品
1.Github(国外最大的代码仓库)
2.Gitee(码云 阿里)
3.Coding(扣钉 腾讯)
4.Codehub(华为)
5.GitLab(开源的私有远程仓库)
gitee码云远程仓库使用
## 全局设置
[root@web02 ~]# git config --global user.name "白菜丶"
[root@web02 ~]# git config --global user.email "11306368+chinese-baicia@user.noreply.gitee.com"
## 推送本地仓库代码到远程仓库
# 将远程仓库的地址保存到本地git仓库的配置文件中
[root@web02 ~]# cd /web/
[root@web02 web]# git remote add origin https://gitee.com/chinese-baicia/git-test.git
remote:远端,远程
add:添加
origin:远程仓库的名字(可自定义)
# 将本地仓库代码推送到远程仓库,将代码推送到名字为'origin'的远程仓库的master分支
[root@web02 web]# git push -u origin "master"
# 查看一个本地仓库添加了几个远程仓库
[root@web02 web]# git remote -v
origin git@gitee.com:chinese-baicia/git-test.git (fetch)
origin git@gitee.com:chinese-baicia/git-test.git (push)
## 1.创建秘钥对
[root@web02 web]# ssh-keygen
## 2.查看公钥
[root@web02 web]# cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCklWEXUSKf6YUBKyrnn4/Y9uOJiHJOvOVaojII68JanWKt4YZlbU82VEqEViFKZSgWb1JYIcsVqH9FcN2RA9Ab9oq8EfU7Y3fqbzLQx6dhK41LY631q//PvaWQYEMfiDB5SRf0eBG7VUEzNy54mi/EtUELFdmIl23eRyEgkucrxKIe4xqVb1wqZ+wfEZt4/95pj63ySNT9oqyNQgEQgs+1B+EXNOZvnHleeBWUU82XGjN4rTHWa8aiagwFnNYBVU4nKLuqZG2B3czVS0lazqKF19d7bRseSeexi2w346loph/qklwTL5d/d+zxl1eKkkK7hZvFa7iH/1ikU8lcRQT/ root@web02
## 推送指定分支
[root@web02 web]# git push -u origin ceo_branch
## 推送所有分支
[root@web02 web]# git push -u origin --all
## 推送标签
[root@web02 web]# git push -u origin --tag
## 每次修改代码之后,要做的操作
# 1.将新写的代码加入暂存区
[root@web02 web]# git add .
# 2.提交代码
[root@wen02 web]# git commit -m 'v111'
# 3.打标签(可打 可不打)
# 4.推送代码到远程仓库
[root@web02 web]# git push //默认推送代码到上一次推送的仓库
[root@web02 web]# git push -u origin master // 指定远程仓库推送