美文网首页
Github 远程仓库

Github 远程仓库

作者: 码农工号9527 | 来源:发表于2023-08-20 16:11 被阅读0次

1、github.com 注册账户

2、github 上创建仓库

3、本地服务器生成 ssh 公钥

[root@qfedu.com ~]# ssh-keygen -t rsa -C 'meteor@163.com'  # 邮箱要与github上注册的相同
[root@qfedu.com ~]# 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 公钥

复制以上的公钥,在 github 中添加ssh key

5、测试连接

[root@qfedu.com ~]# yum install git
........
[root@qfedu.com ~]# ssh -T git@qfedu.comhub.com
The authenticity of host 'github.com (13.250.177.223)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
RSA key fingerprint is MD5:16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,13.250.177.223' (RSA) to the list of known hosts.
Hi meteor! You've successfully authenticated, but GitHub does not provide shell access.
[root@qfedu.com ~]#

6、连接远程仓库(创建一个测试存储库)



git 初始化,然后做第一个基本的git操作(需要在github上创建存储库)

# 在 github 网站新建一个仓库,命名为linux
~~~
[root@qfedu.com ~]# cd /opt
[root@qfedu.com ~]# mkdir linux
[root@qfedu.com ~]# cd linux
~~~
# git 初始化,然后做第一个基本的git操作(需要在github上创建存储库)
[root@qfedu.com ~]# git init
[root@qfedu.com ~]# touch README
[root@qfedu.com ~]# git add README
[root@qfedu.com ~]# git commit -m 'first commit'
[root@qfedu.com ~]# git remote add origin git@qfedu.comhub.com:userhub/linux.git
~~~
# 若出现origin已经存在的错误,删除origin
[root@qfedu.com linux]# git remote rm origin
# 现在继续执行push到远端
~~~
[root@qfedu.com linux]# git remote add origin git@qfedu.comhub.com:userhub/linux.git
[root@qfedu.com linux]# git push -u origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 205 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@qfedu.comhub.com:fakehydra/linux-.git
 * [new branch]      master -> master
分支 master 设置为跟踪来自 origin 的远程分支 master。
# 注意
# 设置存储库链接
[root@qfedu.com ~]# git remote set-url origin git@qfedu.comhub.com:userhub/linux.git
# 如果 push 失败,合并分支到 master 再 push
[root@qfedu.com ~]# git pull --rebase origin master

相关文章

  • github | 仓库和分支管理

    1. 仓库管理 提示:仓库一般就指的是远程仓库即github的仓库.参阅:github 创建远程分支以及远程分支无...

  • git 基本用法

    注册github账号 用法 1. 远程仓库-->本地仓库(克隆) a)创建远程仓库gitDemob)从远程仓库克隆...

  • Git 远程仓库及分支管理

    前提:已有远程仓库项目 远程仓库信息: 来源:github远程仓库(YOUR_FORK)地址: https://g...

  • git

    添加远程仓库 从远程仓库克隆 将本地仓库内容提交github 从远程更新

  • git常用指令

    1) 远程仓库相关命令 检出仓库: 检出仓库: 直接检出分支 2.0.0,指定远程仓库名称为 github (默认...

  • GitHub入门(二)——远程仓库

    二、GitHub远程仓库 1.连接远程库 本地Git仓库和GitHub仓库之间的传输是通过SSH加密传输的,需要配...

  • pycharm与远程仓库进行连接

    个人操作远程仓库的步骤 一 .github创建远程仓库------->克隆到本地仓库--------->维护本地代...

  • 【转载】git使用教程-涂根华

    文章来源部分图片来源 五.远程仓库 (一).提交到网上的远程仓库 一.前提: github仓库 ,本地git仓库 ...

  • git总结

    本地文件夹关联远程仓库 在github上新建远程仓库, 在本地文件夹下 git init 添加远程仓库:git ...

  • Git版本控制器的基本使用

    1.创建远程仓库 建立远程仓库,就是在代码托管服务器上有可远程访问的空间.以gitHub为例,打开 Github,...

网友评论

      本文标题:Github 远程仓库

      本文链接:https://www.haomeiwen.com/subject/dtgsmdtx.html