git命令

git 配置名称和邮箱

配置名称

$ git config --global user.name "wangchunhe"

配置邮箱

$ git config --global user.email "wangchunhe@qq.com"

git 配置ssh

$ ssh-keygen -t rsa -C "chunhewang@qq.com"
  • 运行结果
20258438@jy104882 MINGW64 ~/Desktop (master)
$ ssh-keygen -t rsa -C "chunhewang@qq.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/20258438/.ssh/id_rsa):
/c/Users/20258438/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):(直接回车)
Enter same passphrase again:(直接回车)
Your identification has been saved in /c/Users/20258438/.ssh/id_rsa.
Your public key has been saved in /c/Users/20258438/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Jn1pQchYE8kr1gcXIw5OeEnCaMaXD9o9FkU+yDsOvcE chunhewang@qq.com
The key's randomart image is:
+---[RSA 2048]----+
| . o.++OB++.     |
|  = *===*+..     |
| o + =+o++.      |
|  . .oBoo..o     |
|    .oEoS.+      |
|     o * o       |
|      o          |
|                 |
|                 |
+----[SHA256]-----+
  • 添加ssh key
    在我的电脑上路径/c/Users/20258438目录下,生成了一个.ssh文件夹,打开后里面有三个文件分别know_hosts和两个id_rsa文件,其中有一个id_rsa的后缀为.pub,将里面的内容复制到githua或者gitLab中添加ssh的地方即可。

git 分支

查看所有分支

$ git branch -a
  • 运行结果
20258438@jy104882 MINGW64 /e/project/test (release)
$ git branch -a
* release
  remotes/origin/HEAD -> origin/release
  remotes/origin/dev_jzy
  remotes/origin/develop
  remotes/origin/release

创建分支

$ git branch dev_wangchunhe
  • 运行结果
20258438@jy104882 MINGW64 /e/project/test(release)
$ git branch dev_wangchunhe

查看本地分支

$ git branch
  • 运行结果
20258438@jy104882 MINGW64 /e/project/test (release)
$ git branch
  dev_wangchunhe
* release

切换分支

$ git checkout dev_wangchunhe
  • 运行结果
20258438@jy104882 MINGW64 /e/project/test (release)
$ git checkout dev_wangchunhe
Switched to branch 'dev_wangchunhe'
M       .idea/compiler.xml
D       .idea/dictionaries/admin.xml
M       .idea/gradle.xml
D       .idea/markdown-navigator.xml
D       .idea/markdown-navigator/profiles_settings.xml
M       .idea/misc.xml
M       .idea/modules.xml
M       .idea/runConfigurations.xml
D       .idea/vcs.xml
M       local.properties

将本地分支推送到远程

$ git push origin dev_wangchunhe
  • 运行结果
20258438@jy104882 MINGW64 /e/project/test (dev_wangchunhe)
$ git push origin dev_wangchunhe
Total 0 (delta 0), reused 0 (delta 0)
To 172.28.2.93:LearningApplication/test.git
 * [new branch]      dev_wangchunhe -> dev_wangchunhe
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值