前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >使用Git上传至GitHup

使用Git上传至GitHup

作者头像
dogfei
发布2020-07-31 15:08:46
6230
发布2020-07-31 15:08:46
举报
文章被收录于专栏:devops探索devops探索

1、安装Git

1

yum -y install git

2、创建Githup账号,官网

3、生成ssh key

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

[root@blog_site .ssh]# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: SHA256:wcI81DO4V/IHAPWEnna8VFNbaJPvkg5VynEoUPT8GqQ root@blog_site The key's randomart image is: +---[RSA 2048]----+ | o=ooo+o..+.| | +..*oo +oBoo| | =ooO.o ==B | | .o=.= .o+..| | oSo oE..o.| | . . oo.| | o.. | | . | | | +----[SHA256]-----+ 一路回车

4、将公钥添加到GitHup上

地址

5、验证

1 2 3 4 5 6 7

[root@blog_site Blog_sit]# ssh -T git@github.com The authenticity of host 'github.com (192.30.253.112)' 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,192.30.253.112' (RSA) to the list of known hosts. Hi devilf! You've successfully authenticated, but GitHub does not provide shell access.

6、创建一个目录作为本地仓库

1 2 3 4

mkdir /Blog_site git init git remote add origin git@github.com:devilf/Blog_site.git git push origin master

7、从GitHup克隆项目到本地

1 2 3

[root@blog_site Blog_sit]# git clone https://github.com/devilf/Blog_site.git Cloning into 'Blog_site'... warning: You appear to have cloned an empty repository.

本地的版本不是最新的时候,可以使用命令更新

1

git fetch origin

把更新的内容合并到本地分支:

1 2

git merge origin/master git pull origin master #拉取最新版本并自动合并

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档