当前位置:   article > 正文

Git-远程仓库(GitLab)_your ssh key is expiring soon. please generate a n

your ssh key is expiring soon. please generate a new key
系列文章

Git-入门小结
Git-分支
Git-常用命令
Git-注册远程仓库

Git-远程仓库

1.生成SSH KEY

ssh-keygen -t rsa -C "youremail@xx.com"
//git里注册的邮箱,可以用git config --global user.email查看

Generating public/private rsa key pair.
Enter file in which to save the key 
(/c/Users/Administrator/.ssh/id_rsa)://按Enter
/c/Users/Administrator/.ssh/id_rsa already exists.
Overwrite (y/n)? y//这里我的文件夹里已经有SSH key了,命令行提示要不要重新写入

/**
*设置passphrase后,进行版本控制时,
*每次与远程仓库通信都会要求输入passphrase,
*这里我直接Enter不输入密码
**/
Enter passphrase (empty for no passphrase)://Enter
Enter same passphrase again://Enter

Your identification has been saved in /c/Users/Administrator/.ssh/id_rsa.
Your public key has been saved in /c/Users/Administrator/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:X.........................oo your_emial@examle.com
The key's randomart image is:
+---[RSA 2048]----+
|                 |
|       o .       |
|      = +        |
|     . * o       |
|  o o = S .      |
| = = = + .       |
|o B = + o        |
|o= = =B=.*       |
|E.o ++=@O.o      |
+----[SHA256]-----+


  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35

2.查看公钥

cd ~/.ssh//进入.ssh文件夹
cat id_rsa.pub//查看公钥
  • 1
  • 2

3.与gitlab关联

img

4.clone

git clone URL
git clone -b dev URL//clone指定分支下代码
  • 1
  • 2
  • 选好项目

在这里插入图片描述

  • clone到本地

在这里插入图片描述

4.push and pull

git fetch origin dev//从origin服务器更新代码,此时代码被更新到仓库
git pull origin dev//从origin服务器更新代码,此时代码被更新到工作区
git push origin dev//将仓库中dev分支代码推送到服务器分支上
  • 1
  • 2
  • 3

fetch步骤:

  • git fetch
  • git merge
//方法一
$ git fetch origin master //从远程的origin仓库的master分支下载代码到本地的origin master

$ git log -p master.. origin/master//比较本地的仓库和远程参考的区别

$ git merge origin/master//把远程下载下来的代码合并到本地仓库,远程的和本地的合并

//方法二
$ git fetch origin master:temp //从远程的origin仓库的master分支下载到本地并新建一个分支temp

$ git diff temp//比较master分支和temp分支的不同

$ git merge temp//合并temp分支到master分支

$ git branch -d temp//删除temp
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

$ git fetch origin bug
remote:
remote: INFO: Your SSH key is expiring soon. Please generate a new key.
remote:
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), 286 bytes | 4.00 KiB/s, done.
From gitlab.inhand.design:tangzh/first-try
 * branch            bug        -> FETCH_HEAD
   c5c305d..e9697ad  bug        -> origin/bug

$ git merge 'origin/bug'
Updating e123480..e9697ad
Fast-forward
 try0.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/466617
推荐阅读
相关标签
  

闽ICP备14008679号