本文主要是介绍③Git仓库之三大仓库、github仓库、全网最细,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
文章目录
- Github 远程仓库
只要看了Gitlab仓库操作放法 其他仓库全部都是一样操作
就是Github,默认分支不是master 是main
Github 远程仓库
1、github.com 注册账户
2、在github上创建仓库
3、客户端生成本地ssh key
cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDVThfq4brrlsPGtAknVB0TLPx+7Dd3qlxTbSIrUOsGC5Y8JuNqVTlIntZB4oNj8cSQrWvec9CKm0a8o7WwaJIiqpxurz+YpQHP2KbapftKIxsX4hPf/z+p0El1U6arQa35/xmNsq+cJLH/bDdRG+EMDhuCBmjVZOlLj/hEdeIT6s56AnnCkaWoF+sq58KCF7Tk54jRbs/YiyE4SN7FuA70r+07sA/uj0+lmuk4E190KtQUELhjX/E9stivlqiRhxnKvVUqXDywsjfM8Rtvbi4Fg9R8Wt9fpd4QwnWksYUoR5qZJFYXO4hSZrUnSMruPK14xXjDJcFDcP2eHIzKgLD1 meteor@163.com
4、复制以上的公钥,在github 中添加ssh key
创建好库之后,在库里创建几个文件,方便测试
5、测试:拉取github仓库
[root@localhost ~]# yum install git
[root@localhost ~]# git config --global user.name 'meteor_by'
[root@localhost ~]# git config --global user.email 'meteor@163.com'
[root@localhost tmp]# cd /tmp[root@localhost tmp]# git clone git@github.com:youngfit/youngfit.git
7、在本地添加远程仓库,并推送至github仓库
[root@localhost tmp]# cd /tmp/youngfit/[root@localhost youngfit]# vim a.txt
[root@localhost youngfit]# git add .
[root@localhost youngfit]# git commit -m "yufei"[root@client youngfit]# git push origin main
去github界面查看
8、连接远程仓库方法
#[root@localhost testapp]# git remote -v
#origin git@github.com:meteor/python1804.git (fetch)
#origin git@github.com:meteor/python1804.git (push)
#[root@localhost python1804]#
#[root@localhost python1804]# git remote rm origin (如果连接远程的方式不是ssh,可以删除重新添加)
#[root@localhost ~]# git remote add origin git@github.com:meteor/python1804.git
#或
#git remote add origin https://github.com/meteor/python1804.git
#git push -u origin master
[root@client youngfit]# git remote -v
origin git@github.com:youngfit/youngfit.git (fetch)
origin git@github.com:youngfit/youngfit.git (push)
[root@client youngfit]# git remote rm origin
[root@client youngfit]# git remote add origin git@192.168.62.131:root/testapp.git
[root@client ~]# cd /root/testapp/
[root@client testapp]# ls
test.sql test.txt update.txt
[root@client testapp]# vim modify.txt
[root@client testapp]# git add .
[root@client testapp]# git commit -m "modify gitlab from github"
[root@client testapp]# git push origin main
去自己部署的gitlab上查看
这篇关于③Git仓库之三大仓库、github仓库、全网最细的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!