git常见用法

简介:

使用gitlab

(1)删除已有的公钥

 

 

(2)使用Git bash创建RSA 公私玥

使用命令:ssh-keygen.exe

私钥默认路径:/c/Users/admin/.ssh/id_rsa

执行结果:

$ ssh-keygen.exe
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/admin/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/admin/.ssh/id_rsa.
Your public key has been saved in /c/Users/admin/.ssh/id_rsa.pub.
The key fingerprint is:
31:87:7e:23:33:8f:70:61:c9:29:66:a4:7e:2c:db:98 admin@ADMIN-PC
The key's randomart image is:
+--[ RSA 2048]----+
|      .          |
|     o . +       |
|    . + X .      |
|   . + + =       |
|    o + S o      |
|     B o B .     |
|    E . . .      |
|                 |
|                 |
+-----------------+

 

生成的公私玥:

 其中,id_rsa.pub 是公钥,需要拷贝id_rsa.pub内容到github中

 把上述内容拷贝到github中,如下图

 

注意:内容后面不能有空格和换行.

添加成功:

 这样就可以使用git bash直接clone 代码库勒.

使用命令:git clone git@gitlab.rd.chanjet.com:aaa/bb_web.git

 

查看分支:

git branch -r

 

检出指定分支

git checkout origin/dev_revert_online

 

提交修改的文件(commit)

第一次提交时失败

解决方法:

先执行:git config --global user.email "huangwei@chanjet.com"

 然后就提交成功了

 

查看最后一个commit了的文件

git log -n 1

 

 

 

 

提交流程

git add index.html

git commit -m "test" *

git push

 

$ git checkout
Your branch is up-to-date with 'origin/master-bug'.

相关文章
|
18天前
|
人工智能 数据可视化 开发工具
Git log 进阶用法(含格式化、以及数据过滤)
Git log 进阶用法(含格式化、以及数据过滤)
|
7月前
|
开发工具 git
【Git用法】git常用命令
【Git用法】git常用命令
39 0
|
4月前
|
存储 数据可视化 前端开发
20个常用的 Git 指令用法
20个常用的 Git 指令用法
101 1
|
5月前
|
开发工具 git
git 高级用法
git 高级用法
35 0
git 高级用法
|
5月前
|
存储 开发工具 数据安全/隐私保护
Git和Github的基本用法
Git和Github的基本用法
|
9月前
|
安全 开发工具 git
|
10月前
|
缓存 IDE 编译器
Git文件.gitignore和.gitkeep用法解析
Git文件.gitignore和.gitkeep用法解析
280 0
|
11月前
|
开发工具 数据安全/隐私保护 git
Git和Github的基本用法(内含如何下载)
Git和Github的基本用法(内含如何下载)
|
12月前
|
安全 IDE 网络协议
【Git】版本控制之基础用法
进公司毕竟是多人协作的事情,不是你一个人在更改代码,所以必须要会代码管理工具来多人管理代码。(如果一个人干所有人的活当我没说) 作为2023年代码管理工作最为出名的分布式那肯定还是Git。 当然也有其他的,比如SVN等等。 这篇主要讲解的是Git的使用。
80 0
|
开发工具 数据安全/隐私保护 git
Git和Github的基本用法
Git和Github的基本用法
Git和Github的基本用法