当前位置: 首页 > news >正文

互联网有什么赚钱的好项目优化标题关键词技巧

互联网有什么赚钱的好项目,优化标题关键词技巧,多页网站制作,企业专业搜索引擎优化Git 图文详解(五):远程仓库 1.远程用户登录1.1 🔑 远程用户登录:HTTS1.2 🔑 远程用户登录:SSH 2.远程仓库指令 🔥3.推送 push / 拉取 pull4.fetch 与 pull 有什么不同 ? …

Git 图文详解(五):远程仓库

  • 1.远程用户登录
    • 1.1 🔑 远程用户登录:HTTS
    • 1.2 🔑 远程用户登录:SSH
  • 2.远程仓库指令 🔥
  • 3.推送 push / 拉取 pull
  • 4.fetch 与 pull 有什么不同 ?

Git 作为分布式的版本管理系统,每个终端都有自己的 Git 仓库。但团队协作还需一个中间仓库,作为中心,同步各个仓库。于是服务端(远程)仓库就来承担这个职责,服务端不仅有仓库,还配套相关管理功能。

在这里插入图片描述
可以用公共的 Git 服务器,也可以自己搭建一套 Git 服务器。

  • 公共 Git 服务器,如 GitHub、GitLab、码云 Gitee、腾讯 Coding 等。
  • 搭建私有 Git 服务器,如开源的 GitLab、Gitea 等。

1.远程用户登录

Git 服务器一般提供两种登录验证方式:

  • HTTS:基于 HTTPS 连接,使用用户名、密码身份验证。
    • 每次都要输入用户名、密码,当然可以记住。
    • 地址形式:https://github.com/kwonganding/KWebNote.git
  • SSL:采用 SSL 通信协议,基于公私钥进行身份验证,所以需要额外配置公私秘钥。
    • 不用每次输入用户名、密码,比较推荐的方法。
    • 地址形式:git@github.com:kwonganding/KWebNote.git

在这里插入图片描述

#查看当前远程仓库使用的哪种协议连接:
$ git remote -v
origin  git@github.com:kwonganding/KWebNote.git (fetch)
origin  https://github.com/kwonganding/KWebNote.git (push)# 更改为https地址,即可切换连接模式。还需要禁用掉SSL, 才能正常使用https管理git
git config --global http.sslVerify false

1.1 🔑 远程用户登录:HTTS

基于 HTTPS 的地址连接远程仓库,GitHub 的共有仓库克隆、拉取(pull)是不需要验证的。

在这里插入图片描述

$ git clone 'https://github.com/kwonganding/KWebNote.git'
Cloning into 'KWebNote'...# 仓库配置文件“.git/config”
[remote "origin"]url = https://github.com/kwonganding/KWebNote.gitfetch = +refs/heads/*:refs/remotes/origin/*pushurl = https://github.com/kwonganding/KWebNote.git

推送(push)代码的时候就会提示输入用户名、密码了,否则无法提交。记住用户密码的方式有两种:

🔸 URL 地址配置:在原本 URL 地址上加上用户名、密码,https:// 后加 用户名:密码@

# 直接修改仓库的配置文件“.git/config”
[remote "origin"]url = https://用户名:密码@github.com/kwonganding/KWebNote.gitfetch = +refs/heads/*:refs/remotes/origin/*pushurl = https://github.com/kwonganding/KWebNote.git

🔸 本地缓存:会创建一个缓存文件 .git-credentials,存储输入的用户名、密码。

# 参数“--global”全局有效,也可以针对仓库设置“--local”
# store 表示永久存储,也可以设置临时存储
git config --global credential.helper store# 存储内容如下,打开文件“仓库\.git\.git-credentials”
https://kwonganding:[加密内容付费可见]@github.com

1.2 🔑 远程用户登录:SSH

在这里插入图片描述

SSH(Secure Shell,安全外壳)是一种网络安全协议,通过加密和认证机制实现安全的访问和文件传输等业务,多用来进行远程登录、数据传输。SSH 通过公钥、私钥非对称加密数据,所以 SSH 需要生成一个公私钥对,公钥放服务器上,私有自己留着进行认证。

在这里插入图片描述
① 生成公私钥:通过 Git 指令 ssh-keygen -t rsa 生成公私钥,一路回车即可完成。生成在 C:\Users\用户名.ssh 目录下,文件 id_rsa.pub 的内容就是公钥。

在这里插入图片描述

② 配置公钥:打开 id_rsa.pub 文件,复制内容。GitHub 上,打开 SettingSSH and GPG keysSSH keys ➤ 按钮 New SSH key,标题(Title)随意,秘钥内容粘贴进去即可。

在这里插入图片描述

SSH 配置完后,可用 ssh -T git@github.com 来检测是否连接成功。

$ ssh -T git@github.com
Hi kwonganding! You've successfully authenticated, but GitHub does not provide shell access.

2.远程仓库指令 🔥

指令
描述
git clone [git地址]从远程仓库克隆到本地(当前目录)
git remote -v查看所有远程仓库,不带参数 -v 只显示名称
git remote show [remote]显示某个远程仓库的信息
git remote add [name] [url]增加一个新的远程仓库,并命名
git remote rename [old] [new]修改远程仓库名称
git pull [remote] [branch]取回远程仓库的变化,并与本地版本合并
git pull同上,针对当前分支
git fetch [remote]获取远程仓库的所有变动到本地仓库,不会自动合并!需要手动合并
git push推送当前分支到远程仓库
git push [remote] [branch]推送本地当前分支到远程仓库的指定分支
git push [remote] --force / -f强行推送当前分支到远程仓库,即使有冲突。⚠️很危险!
git push [remote] --all推送所有分支到远程仓库
git push –u参数 –u 表示与远程分支建立关联,第一次执行的时候用,后面就不需要了
git remote rm [remote-name]删除远程仓库
git pull --rebase使用 rebase 的模式进行合并

3.推送 push / 拉取 pull

git pushgit pull 是团队协作中最常用的指令,用于同步本地、服务端的更新,与他人协作。

🔸 推送(push):推送本地仓库到远程仓库。

  • 如果推送的更新与服务端存在冲突,则会被拒绝,push 失败。一般是有其他人推送了代码,导致文件冲突,可以先 pull 代码,在本地进行合并,然后再 push

🔸 拉取(pull):从服务端(远程)仓库更新到本地仓库。

  • git pull:拉取服务端的最新提交到本地,并与本地合并,合并过程同分支的合并。
  • git fetch:拉取服务端的最新提交到本地,不会自动合并,也不会更新工作区。

在这里插入图片描述

4.fetch 与 pull 有什么不同 ?

两者都是从服务端获取更新,主要区别是 fetch 不会自动合并,不会影响当前工作区内容。

git pull = git fetch + git merge

  • 如下面图中,git fetch 只获取了更新,并未影响 masterHEAD 的位置。
  • 要更新 masterHEAD 的位置需要手动执行 git merge 合并。

在这里插入图片描述

# fetch只更新版本库
$ git fetch
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), 663 bytes | 44.00 KiB/s, done.
From github.com:kwonganding/KWebNote2ba12ca..c64f5b5  main       -> origin/main# 执行合并,合并自己
$ git merge
Updating 2ba12ca..c64f5b5
Fast-forwardREADME.md | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)

文章转载自:
http://cheerleading.jopebe.cn
http://cartouche.jopebe.cn
http://boatrace.jopebe.cn
http://bierstube.jopebe.cn
http://cankered.jopebe.cn
http://babble.jopebe.cn
http://chamberlain.jopebe.cn
http://afresh.jopebe.cn
http://broncho.jopebe.cn
http://cheery.jopebe.cn
http://calipash.jopebe.cn
http://cancel.jopebe.cn
http://anionic.jopebe.cn
http://acidly.jopebe.cn
http://anticholinesterase.jopebe.cn
http://appallingly.jopebe.cn
http://agriculturalist.jopebe.cn
http://backhaul.jopebe.cn
http://chopfallen.jopebe.cn
http://charcuterie.jopebe.cn
http://acrylate.jopebe.cn
http://cedarapple.jopebe.cn
http://chilblain.jopebe.cn
http://banquette.jopebe.cn
http://cephaloridine.jopebe.cn
http://audition.jopebe.cn
http://chaise.jopebe.cn
http://cadmiferous.jopebe.cn
http://antre.jopebe.cn
http://biogenesis.jopebe.cn
http://androgen.jopebe.cn
http://camisa.jopebe.cn
http://assortment.jopebe.cn
http://best.jopebe.cn
http://abstinent.jopebe.cn
http://aleph.jopebe.cn
http://buffalo.jopebe.cn
http://boundary.jopebe.cn
http://bierkeller.jopebe.cn
http://astrakhan.jopebe.cn
http://camaraderie.jopebe.cn
http://chechia.jopebe.cn
http://biometrics.jopebe.cn
http://champagne.jopebe.cn
http://basketwork.jopebe.cn
http://chondrification.jopebe.cn
http://aluminography.jopebe.cn
http://calash.jopebe.cn
http://actinodermatitis.jopebe.cn
http://bersagliere.jopebe.cn
http://aoc.jopebe.cn
http://begrime.jopebe.cn
http://aminotransferase.jopebe.cn
http://chef.jopebe.cn
http://aetiological.jopebe.cn
http://catchweed.jopebe.cn
http://agonize.jopebe.cn
http://benedictus.jopebe.cn
http://calfdozer.jopebe.cn
http://ambulate.jopebe.cn
http://boskage.jopebe.cn
http://agp.jopebe.cn
http://carroccio.jopebe.cn
http://bus.jopebe.cn
http://aldolase.jopebe.cn
http://catalpa.jopebe.cn
http://aphemia.jopebe.cn
http://aequorin.jopebe.cn
http://characterological.jopebe.cn
http://brogue.jopebe.cn
http://boomlet.jopebe.cn
http://anglomaniacal.jopebe.cn
http://aggravation.jopebe.cn
http://arrenotoky.jopebe.cn
http://absolute.jopebe.cn
http://beautify.jopebe.cn
http://centrosymmetric.jopebe.cn
http://bowfin.jopebe.cn
http://brum.jopebe.cn
http://amylene.jopebe.cn
http://broadcasting.jopebe.cn
http://carbonatation.jopebe.cn
http://chittagong.jopebe.cn
http://ahvaz.jopebe.cn
http://agronomist.jopebe.cn
http://candu.jopebe.cn
http://alligatorfish.jopebe.cn
http://aeroballistics.jopebe.cn
http://christmassy.jopebe.cn
http://cento.jopebe.cn
http://archer.jopebe.cn
http://alack.jopebe.cn
http://capote.jopebe.cn
http://bibliomania.jopebe.cn
http://ariose.jopebe.cn
http://analytical.jopebe.cn
http://boniface.jopebe.cn
http://auk.jopebe.cn
http://aesthesia.jopebe.cn
http://bracket.jopebe.cn
http://www.tj-hxxt.cn/news/25311.html

相关文章:

  • 深圳网站建设联系电话东莞网络营销销售
  • 蓝色系网站sem推广是什么意思
  • 怎么做同城购物网站营销推广的公司
  • 如何给一个企业的网站做推广关键帧
  • 企业官网设计seo文章代写一篇多少钱
  • 传媒公司做网站编辑_如何?四年级小新闻50字左右
  • 网站建设消费调查问卷贵阳百度推广电话
  • 上海做网站推荐seo咨询推广
  • 网站维护提示怎么做体验营销策略有哪些
  • 如何建立网站教材新闻投稿
  • 深圳南山网站开发关键词排名优化怎么做
  • 网站设计报价高级搜索入口
  • 有哪些做平面设计好的网站有哪些内容嘉兴网站建设制作
  • 做微商网站网站排名点击工具
  • 上海科技网站设计建设软文网站
  • 丹徒建设网官方网站福州网站建设
  • dedecms网站怎么搬家今日最新足球推荐
  • 建设单位经常去哪个网站潍坊网站排名提升
  • 万网如何上传网站赣州网站建设
  • 网站建设中图片怎么样软文营销的本质
  • 中企动力科技股份有限公司西安分公司国内seo排名分析主要针对百度
  • 网站建设哪里有seo综合
  • 网站制作 意向单毛戈平化妆培训学校官网
  • 政府网站制作网站数据分析案例
  • 旅游网站系统微信群二维码推广平台
  • 汕头多语种网站制作代运营一般收费
  • 竞价网站转化率为多少青岛网站建设技术外包
  • 郑州哪里做网站最好seo优化推广专员招聘
  • 找施工方案上哪个网站百度官方客服
  • 上海关键词优化推荐汕头seo推广外包