程序员的资源宝库

网站首页 > gitee 正文

git远程仓库-码云 git管理远程仓库

sanyeah 2024-03-29 14:52:59 gitee 5 ℃ 0 评论

git远程仓库

git远程仓库衍生品

1.Github(国外最大的代码仓库)
2.Gitee(码云 阿里)
3.Coding(扣钉 腾讯)
4.Codehub(华为)
5.GitLab(开源的私有远程仓库)

gitee码云远程仓库使用

## 全局设置
git config --global user.name "driverzeng"
git config --global user.email "133411023@qq.com"

## 推送本地仓库代码到远程仓库
# 将远程仓库的地址保存到本地git仓库的配置文件中
[root@gitlab web]# git remote add origin https://gitee.com/driverzeng/linux2.git
remote:远端,远程
add:添加
origin:远程仓库的名字(可自定义)
远程仓库的地址
[root@gitlab web]# git remote add huanglong_sb git@gitee.com:driverzeng/sb_huanglong.git

# 将本地仓库代码推送到远程仓库,将代码推送到名字为'origin'的远程仓库的master分支
[root@gitlab web]# git push -u origin "ceo_branch"
-u:指定远程仓库的名字 "master"

# 查看一个本地仓库添加了几个远程仓库
[root@gitlab web]# git remote -v
huanglong_sb	git@gitee.com:driverzeng/sb_huanglong.git (fetch)
huanglong_sb	git@gitee.com:driverzeng/sb_huanglong.git (push)
origin	https://gitee.com/driverzeng/linux2.git (fetch)
origin	https://gitee.com/driverzeng/linux2.git (push)

# 1.创建秘钥对
[root@gitlab web]# ssh-keygen 

# 2.查看公钥
[root@gitlab web]# cat ~/.ssh/id_rsa.pub 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0ISYnOciJDR9c7PXYnxleCArE/YjubjU4DS+zcBlEcIEuchlbufQ0uQKDyxFY5hADkw7lToJIIo1sS62z1mvgl4ObB+PB6J3XNEt/DnqUo+Xm61UlTMBdOgBRi3eFvm6sJWxdHQS9ci3Cvx8L2+Mj/At+90AbhBV3NqYh5SIdqPoAvIbvnuWvmLLyWoHjM+2l4Ok3+plYIfEAHBio8rB3R7wFeCX2LOl/yGUj3fdQce7ewY2AcRC60PWSTfDhicTRNnkB47QGocKOsNTKnp7D4Hqrhy3dHOlUd6akwwaZalwPdq03UQ3eVmtp41EUtui7ufv8V0miwqItOg+SS0LZ root@gitlab

# 推送到指定分支
[root@gitlab web]# git push -u huanglong_sb ceo_branch
# 推送所有分支
[root@gitlab web]# git push -u huanglong_sb --all
# 推送标签
[root@gitlab web]# git push -u huanglong_sb --tag


## 每次修改代码之后,要做的操作
# 1.将新写的代码加入暂存区
[root@gitlab web]# git add .
# 2.提交代码
[root@gitlab web]# git commit -m 'v111'
# 3.打标签(可打 可不打)
# 4.推送代码到远程仓库
[root@gitlab web]# git push      //默认推送代码到上一次推送的仓库
[root@gitlab web]# git push -u origin master   // 指定远程仓库推送

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表