“Git”的版本间的差异

来自qingwei personal wiki
跳转至: 导航搜索
windows下
第2行: 第2行:
 
=== windows下 ===
 
=== windows下 ===
 
<source lang="shell">
 
<source lang="shell">
 +
#生成ssh key的命令
 
qingwyan@QINGWYAN-FTCEW MINGW64 ~/Desktop/git
 
qingwyan@QINGWYAN-FTCEW MINGW64 ~/Desktop/git
 
$ ssh-keygen -t rsa -C "qingwyan@cisco.com"
 
$ ssh-keygen -t rsa -C "qingwyan@cisco.com"
Generating public/private rsa key pair.
 
Enter file in which to save the key (/c/Users/qingwyan/.ssh/id_rsa):
 
/c/Users/qingwyan/.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/qingwyan/.ssh/id_rsa.
 
Your public key has been saved in /c/Users/qingwyan/.ssh/id_rsa.pub.
 
The key fingerprint is:
 
SHA256:lV3+ql6FzMYvtjCEM5p3Lkquv/6bu+Qykn98JfjsG5w qingwyan@cisco.com
 
The key's randomart image is:
 
+---[RSA 2048]----+
 
|              .  |
 
|          o o  |
 
|          o . .  |
 
|        . . + o |
 
|        S +.. * o|
 
|        o.=.o.+ |
 
|      .+.ooEo= .|
 
|      ooo++++B o |
 
|      .*BBBO*..  |
 
+----[SHA256]-----+
 
  
 +
# 进入到生成的ssh key目录
 
qingwyan@QINGWYAN-FTCEW MINGW64 ~/Desktop/git
 
qingwyan@QINGWYAN-FTCEW MINGW64 ~/Desktop/git
 
$ cd /c/Users/qingwyan/.ssh
 
$ cd /c/Users/qingwyan/.ssh
  
 +
# copy到剪切板
 
qingwyan@QINGWYAN-FTCEW MINGW64 ~/.ssh
 
qingwyan@QINGWYAN-FTCEW MINGW64 ~/.ssh
 
$ clip < id_rsa.pub
 
$ clip < id_rsa.pub

2017年12月21日 (四) 06:34的版本

SSH key生成

windows下

#生成ssh key的命令
qingwyan@QINGWYAN-FTCEW MINGW64 ~/Desktop/git
$ ssh-keygen -t rsa -C "qingwyan@cisco.com"

# 进入到生成的ssh key目录
qingwyan@QINGWYAN-FTCEW MINGW64 ~/Desktop/git
$ cd /c/Users/qingwyan/.ssh

# copy到剪切板
qingwyan@QINGWYAN-FTCEW MINGW64 ~/.ssh
$ clip < id_rsa.pub

常见错误

git pull/fetch: unable to update local ref

  • 现象
[qingwyan@crdc-sdn-ucs2 rpd-service-manager]$ git fetch

error: there are still refs under 'refs/remotes/origin/bugfix/haofan'
From ssh://bitbucket-eng-sjc1.cisco.com:7999/cmtsorch/rpd-service-manager
 ! [new branch]      bugfix/haofan -> origin/bugfix/haofan  (unable to update local ref)
  • 解决方案:删除文件
rm -rf .git/refs/remotes/origin/bugfix/haofan
  • 新的问题
[qingwyan@crdc-sdn-ucs2 rpd-service-manager]$ git fetch

error: 'refs/remotes/origin/bugfix/haofan/device-key' exists; cannot create 'refs/remotes/origin/bugfix/haofan'
From ssh://bitbucket-eng-sjc1.cisco.com:7999/cmtsorch/rpd-service-manager
 ! [new branch]      bugfix/haofan -> origin/bugfix/haofan  (unable to update local ref)
error: some local refs could not be updated; try running
 'git remote prune origin' to remove any old, conflicting branches
  • 按提示删除
git remote prune origin