git本地添加ssh

第一步:生成SSH  Key

Git是分布式的代码管理工具,远程的代码管理是基于SSH的,所以要使用远程的Git则需要SSH的配置。

github的SSH配置如下:

一 、

设置Git的user name和email:

$ git config --global user.name "xuhaiyan"
$ git config --global user.email "[email protected]"


二、生成SSH密钥过程:
1.查看是否已经有了ssh密钥:cd ~/.ssh
如果没有密钥则不会有此文件夹,有则备份删除
2.生存密钥:

$ ssh-keygen -t rsa -C “haiyan.xu.vip@gmail.com”
按3个回车,密码为空。


Your identification has been saved in /home/tekkub/.ssh/id_rsa.
Your public key has been saved in /home/tekkub/.ssh/id_rsa.pub.
The key fingerprint is:

第二步:Git服务器配置SSH Key
把.pub里面的秘药放到Git上去(我这里是直接交给Git的管理者)。 (记得要Git管理者给弄好所有权限!

第三步:使用Git

在本地目录建立一个 GIT库的文件夹



 进入GIT 文件夹.右键空白处选择 Git Bash



输入 git init .初始化本地环境



克隆  GIT 库项目代码到本地
git clone http://git.100msh.com/wzw/admin-100msh-com.git admin.100msh.com
http://git.100msh.com/wzw/admin-100msh-com.git  这个可以找  LA 或者在网页中 GIT 可以看到库 
admin.100msh.com
  重命名本地库名称  .  //此项可有可无   



进入克隆下来的目录  。



猜你喜欢

转载自blog.csdn.net/easyclub_hanjixin/article/details/78216507
今日推荐