GIT详细笔记(END)

简介: GIT详细笔记(END)

Git团队协作

微信截图_20221011205423.png微信截图_20221011205445.png

微信截图_20221011205233.png

创建远程库别名

git remote -v   #查看当前所有进程地址别名
git remote add 别名 远程地址   #起别名
ws199@DESKTOP-2N1I9JA MINGW64 /d/GIT/Git-Space/git.demo (hot-fix)
$ git remote -v
ws199@DESKTOP-2N1I9JA MINGW64 /d/GIT/Git-Space/git.demo (hot-fix)
$ git remote add git.demo https://github.com/weishuoHH/git-demo.git
ws199@DESKTOP-2N1I9JA MINGW64 /d/GIT/Git-Space/git.demo (hot-fix)
$ git remote -v
git.demo        https://github.com/weishuoHH/git-demo.git (fetch)
git.demo        https://github.com/weishuoHH/git-demo.git (push)

推送本地分支上的内容到远程仓库

git push 别名 分支   #推送本地分支上的内容到远程仓库
ws199@DESKTOP-2N1I9JA MINGW64 /d/GIT/Git-Space/git.demo (master)
$ git push git.demo master
Enumerating objects: 21, done.
Counting objects: 100% (21/21), done.
Delta compression using up to 16 threads
Compressing objects: 100% (14/14), done.
Writing objects: 100% (21/21), 1.55 KiB | 792.00 KiB/s, done.
Total 21 (delta 4), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (4/4), done.
To https://github.com/weishuoHH/git-demo.git
 * [new branch]      master -> master

克隆远程库到本地库

git clone 远程地址   #将远程仓库的内容克隆到本地
#clone操作:
1.拉取代码
2.初始化本地库
3.创建别名
ws199@DESKTOP-2N1I9JA MINGW64 /d/GIT/Git-lhc
$ git clone https://github.com/weishuoHH/git-demo.git
Cloning into 'git-demo'...
remote: Enumerating objects: 27, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 27 (delta 6), reused 20 (delta 4), pack-reused 0
Receiving objects: 100% (27/27), done.
Resolving deltas: 100% (6/6), done.
ws199@DESKTOP-2N1I9JA MINGW64 /d/GIT/Git-lhc
$ ll
total 0
drwxr-xr-x 1 ws199 197609 0 Apr 17 14:27 git-demo/
#创建别名
ws199@DESKTOP-2N1I9JA MINGW64 /d/GIT/Git-lhc/git-demo (master)
$ git remote  -v
origin  https://github.com/weishuoHH/git-demo.git (fetch)
origin  https://github.com/weishuoHH/git-demo.git (push)

团队内协作


跨团队合作


GitHub免密登录

#生成ssh免密登录命令  -t "以某种加密算法登录 -C "描述
ws199@DESKTOP-2N1I9JA MINGW64 ~
$ ssh-keygen.exe -t rsa -C weishuoHH@weishuo.com
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/ws199/.ssh/id_rsa):
Created directory '/c/Users/ws199/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/ws199/.ssh/id_rsa
Your public key has been saved in /c/Users/ws199/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:CVIbj1aIxRUz8t0m7WXpzBqwJ6RzNHze+B5dd5Jyiwk weishuoHH@weishuo.com
The key's randomart image is:
+---[RSA 3072]----+
|     +=o*.       |
|    ..oO = o   . |
|    . = o O = +  |
|     o . = X O . |
|        S E B O +|
|         o + O ++|
|            + + .|
|             . . |
|              .  |
+----[SHA256]-----+
ws199@DESKTOP-2N1I9JA MINGW64 ~
$
#通过ssh拉去远程库代码
ws199@DESKTOP-2N1I9JA MINGW64 /d/GIT/Git-Space/git.demo (master)
$ git pull git@github.com:weishuoHH/git-demo.git master
The authenticity of host 'github.com (20.205.243.166)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? y
Please type 'yes', 'no' or the fingerprint: yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
From github.com:weishuoHH/git-demo
 * branch            master     -> FETCH_HEAD
Already up to date.
目录
相关文章
|
Shell 开发工具 git
Git笔记(三)---- Git分支操作
Git笔记(三)---- Git分支操作
128 0
|
2月前
|
Shell 网络安全 开发工具
fatal: unable to access 'https://github.com/wolfcw/libfaketime.git/': Encountered end of file
fatal: unable to access 'https://github.com/wolfcw/libfaketime.git/': Encountered end of file
|
6月前
|
存储 XML Shell
Git笔记
Git笔记
45 0
|
6月前
|
开发工具 git
git使用笔记-修改url并与远端库合并
git使用笔记-修改url并与远端库合并
37 1
|
Shell 开发工具 git
[笔记]Git 介绍以及入门基本功能(一)
[笔记]Git 介绍以及入门基本功能
|
6月前
|
Shell 开发工具 数据安全/隐私保护
git笔记
git笔记
63 0
|
Shell 网络安全 开发工具
git理解之超薄笔记
git理解之超薄笔记
79 1
git理解之超薄笔记
|
Shell 开发工具 git
[笔记]Git 介绍以及入门基本功能(二)
[笔记]Git 介绍以及入门基本功能(二)
|
Shell 网络安全 开发工具
git版本管理加合并笔记
git版本管理加合并笔记
|
开发工具 git
常见git操作笔记
常见git操作笔记
75 1