当前位置:   article > 正文

sourcetree配置ssh以及下载项目_sourcetree如何下载项目到本地

sourcetree如何下载项目到本地

weibu@weibudeMac-mini ~ % ls

Desktop        Library        Pictures    Public

Documents    Movies        Podfile        swift-note

Downloads    Music        Pods

weibu@weibudeMac-mini ~ % cd Desktop

weibu@weibudeMac-mini Desktop % ls

hosts        oc        textOCPro    weiBu

iOS        testSwiftPro    wb        扩展

weibu@weibudeMac-mini Desktop %

weibu@weibudeMac-mini Desktop % cd iOS/

weibu@weibudeMac-mini iOS % ls

OC        Swift        muse_git

weibu@weibudeMac-mini iOS %

weibu@weibudeMac-mini iOS % ssh-keygen -t rsa -C "zhiqiang.wei@zlmicro.com"

Generating public/private rsa key pair.

Enter file in which to save the key (/Users/weibu/.ssh/id_rsa):

Created directory '/Users/weibu/.ssh'.

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /Users/weibu/.ssh/id_rsa

Your public key has been saved in /Users/weibu/.ssh/id_rsa.pub

The key fingerprint is:

SHA256:42ohIVQGexb7hInlF9mdH00k6qIxPubh/UNhoRVnq6Y zhiqiang.wei@zlmicro.com

The key's randomart image is:

+---[RSA 3072]----+

|  .o= .o ..o++o  |

|  .* =... =+.o.  |

| .o B o  o.o..   |

|  .o.+  ..o..    |

|   . .+ S.+.     |

|    ...= =.      |

|     .*.E.       |

|     +.=  .      |

|     .+ ....     |

+----[SHA256]-----+

weibu@weibudeMac-mini iOS % cd

weibu@weibudeMac-mini ~ % cd .ssh

weibu@weibudeMac-mini .ssh % ls

id_rsa        id_rsa.pub

weibu@weibudeMac-mini .ssh % cat id_rsa.pub

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCnV7v51XQUbhPi0P9/r6bLxSi+fZbj7wAam+7fWDtQCmW6Ert1I+g1097V+NzMXzp0SYwYMSQXiv0fIYh+MJkI9GbRXWOMGUx2XiWrJLBRimL+Ug42pj3D0jxfQRKocRRJadzCKS0xGi3DLmy3VUlA/L+SJqVtkCThMCL09/dPxh6bAhwZAdzayIbfDSV1ngZS8mSqkwGGYjZVtnERdg1MAZtR2O0m2QvnkPVYWTXy40FGIn8EFQplVjjFPv7ncLL+g49bJ5jNnBEzcRZNR3BlvEAkboFG6W45/Ojd/CSyM1T/gSHaw/OilESacRQG4R4DO8s7KSKfP+mJ0AwjBjJi025mnc2v7gjPxEhQwzPfPdZj4enDwlpe0P0s3h3QTHI0lE244hd4MxHBP8SFWgijCrOSKrFxgk6kk1j0wWhR4FGCqFCNf/RIPisRDHe3la9IWSoPzTvoCFrsjjokLrdxgeT2WU8lC45ueU+TzUC3MkvI7975QmFwOnduubW8K4U= zhiqiang.wei@zlmicro.com

weibu@weibudeMac-mini .ssh % cd -

~

weibu@weibudeMac-mini ~ % ls

Desktop        Library        Pictures    Public

Documents    Movies        Podfile        swift-note

Downloads    Music        Pods

weibu@weibudeMac-mini ~ % cd Desktop/

weibu@weibudeMac-mini Desktop % ls

hosts        oc        textOCPro    weiBu

iOS        testSwiftPro    wb        扩展

weibu@weibudeMac-mini Desktop % cd iOS

weibu@weibudeMac-mini iOS % ls

OC        Swift        muse_git

weibu@weibudeMac-mini iOS %

weibu@weibudeMac-mini iOS %

weibu@weibudeMac-mini iOS % git clone git@git.zlmicro.com:weibu-ios/muse.git

Cloning into 'muse'...

The authenticity of host 'git.zlmicro.com (121.41.18.157)' can't be established.

ED25519 key fingerprint is SHA256:mh+GX1wb47pRGf2rjQysbWvIq2kU4cmSlv5HCp3pHRI.

This key is not known by any other names

Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

Warning: Permanently added 'git.zlmicro.com' (ED25519) to the list of known hosts.

remote: Enumerating objects: 3, done.

remote: Counting objects: 100% (3/3), done.

remote: Compressing objects: 100% (2/2), done.

remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0

Receiving objects: 100% (3/3), done.

weibu@weibudeMac-mini iOS %

Git解决Permission denied, please try again问题

在git中输入  cat ~/.ssh/id_rsa.pub

若没有,会提示no such file or directory

如果有,就删除,删除命令为:

cd ~

rm -rf .ssh

重新生成SSH Key

ssh-keygen -t rsa -C "your_email@example.com"

按3个回车,密码为空。(不需要输密码)

查看新生成的SSH Key,命令:

cat ~/.ssh/id_rsa.pub

复制git ssh保存即可

end

接下来在.ssh路径下配置全局的name和email,输入以下命令:
git config --global user.name “xxxxx”
git config --global user.email “xxxxx@xx.com”
此处分别指工程文件名,和gitlab账号绑定的邮箱地址。

输入:ssh-keygen -t rsa -C “xxxx@xxxx.com”(xxx为上一句输入的邮箱地址)语句,回车之后生成SSH key,后面出现让输入口令的语句,直接按回车即可,这样系统路径下就生成了两个文件:id_rsa和id_rsa.pub

打开秘钥从上面的 路径找到对应的文件 复制秘钥

将生成的SSH key添加到账户里,在SSH Keys页面里,在页面的右上角点击添加add SSH keys

第二种:

第一步输入:ssh-keygen -t ed25519 -C "邮箱"

第二步 输入代码 打开~/.ssh/config文件(若没有这个文件 ,先创建再打开)

open ~/.ssh/config
 
//没有创建 ~/.ssh/config这个文件的话,先创建,代码如下:
touch ~/.ssh/config

第三步  在~/.ssh/config文件中输入:(在.ssh下打开:open ~/.ssh/config )

Host github.com
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519

并且保存编辑。

第四步 输入代码 将SSH私钥添加到 ssh-agent,并将密码存储在密钥链中

ssh-add --apple-use-keychain ~/.ssh/id_ed25519

第五步 输入代码:

ssh -T git@github.com

第六步  重新输入了一些代码如下:

//1
cd ~/.ssh
//2 这里注意“”前面有空格
git config --global user.name "account name"
git config --global user.email "account email"
ssh-keygen -t rsa -C "account email"
//然后输入密码 -- 输入密码 --entry
//3 查看公有密钥
cat id_rsa.pub 

若无效则复制id_ed25519.pub的公钥到ssh配置里

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/610658
推荐阅读
  

闽ICP备14008679号