Github和码云都提供SSH协议,即用户可以用公钥认证方式连接到码云的SSH服务器。这就需要生成并部署SSH Key。下面就是我生成SSH Key的步骤,希望有所帮助:

Git生成SSH key

在初始化文件鼠标右键,找到Git Bash Here,进入后输入下面2条指令:

git config --global user.name "名称或昵称"
git config --global user.email "你的邮箱"

作用:告诉Git你是谁,邮箱在生成SSH Key需要。

输入上面2条指令后,再输入下面指令:

ssh-keygen -t rsa -C "你的邮箱"

生成结果如下

上面完成后,再输入指令:

cat ~/.ssh/id_rsa.pub

指令下的一大串就是SSH Key(SSH Key是以ssh-rsa AAAA...开头),SSH Key生成完成。

SSH Key部署

  • 部署到Github

    登录Github,点击头像 找到settings

点击右上角New SSH Key,添加成功后在终端输入:

ssh -T git@github.com

若返回有

Hi,你的名称或昵称 You've successfully authenticated ...

证明添加成功!

  • 部署到码云

点击确定即可,添加成功后在终端输入:

ssh -T git@gitee.com

若返回有

Hi,你的名称或昵称 You've successfully authenticated ...

证明添加成功!

简易的命令行入门教程:

Git 全局设置:

git config --global user.name "侯佳"
git config --global user.email "airmour@foxmail.com"

创建 git 仓库:

mkdir fast_repair_brother
cd fast_repair_brother
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://gitee.com/airmour/fast_repair_brother.git
git push -u origin master

已有仓库?

cd existing_git_repo
git remote add origin https://gitee.com/airmour/fast_repair_brother.git
git push -u origin master

git报错:'fatal:remote origin already exists'怎么处理?

只要两步:

1、先删除git remote rm origin

2、再次执行添加就可以了。

Win环境 Android Studio使用Git 教程 ( 生成SSH key )的更多相关文章

  1. Win环境 Android Studio使用Git 教程 ( 一 )

    一. 安装 下载安装完成Git后 进入命令行 输入命令git --version,如果能显示版本则说明安装成功,如果没有显示版本,需要配置环境变量: 在path中添加git的安装位置 二 . 配置信息 ...

  2. git之生成SSH key

    git之生成SSH key SSH 为 Secure Shell 的缩写,由 IETF 的网络小组(Network Working Group)所制定.利用 SSH 协议可以有效防止远程管理过程中的信 ...

  3. Android studio使用git教程

    ①下载Git工具,配置到Android studio中 http://git-scm.com/downloads ------------------------------------------- ...

  4. linux下安装Git并生成SSH key

    系统:contens7.4 1.下载源码解压 wget https://github.com/git/git/archive/v2.3.0.zip unzip v2.3.0.zip cd git-2. ...

  5. git - Mac生成SSH key

    步骤1.检查是否已经存在SSH Key 打开电脑终端,输入以下命令: ls -al ~/.ssh 会出现两种情况 步骤2. 生成/设置SSH Key 继续上一步可能出现的情况 (1)情况一: 终端出现 ...

  6. Git 生成SSH Key

    背景:服务器是LINUX系统(centos7),使用GitLab管理git代码库.各个客户端通过sourcetree 工具,采用SSH获取.提交代码.使用SSH的方式需要公钥和私钥.下面介绍秘钥的生成 ...

  7. 第七章 : Git 介绍 (上)[Learn Android Studio 汉化教程]

    Learn Android Studio 汉化教程 [翻译]Git介绍 Git版本控制系统(VCS)快速成为Android应用程序开发以及常规的软件编程领域内的事实标准.有别于需要中心服务器支持的早期 ...

  8. 第七章 : Git 介绍 (下)[Learn Android Studio 汉化教程]

    Learn Android Studio 汉化教程 Let’s reset even further to remove all traces of your work on the deprecat ...

  9. 第五章:Reminders实验:第一部分[Learn Android Studio 汉化教程]

    Learn Android Studio 汉化教程 By now you are familiar with the basics of creating a new project, program ...

随机推荐

  1. mybatis 反向生成步骤

    Mybatis 反向生成. 反向生成的步骤: 反向生成的文件 打开文件夹显示 3.打开generator.xml文件 更改配置信息  路径一般情况下用英文  中文的路径有些会识别不了  或产生乱码 4 ...

  2. Collection中的List,Set的toString()方法

    代码:     Collection c = new ArrayList();     c.add("hello");     c.add("world"); ...

  3. November 10th, 2017 Week 45th Friday

    A little bit of mercy makes the world less cold and more just. 多一点怜悯就可以让这个世界少一点冷酷而多一点正义. Maybe there ...

  4. 2018.09.01 09:22 Exodus

    Be careful when writing in the blog garden. Sometimes you accidentally write something wrong, and yo ...

  5. Pandas Learning

    Panda Introduction Pandas 是基于 NumPy 的一个很方便的库,不论是对数据的读取.处理都非常方便.常用于对csv,json,xml等格式数据的读取和处理. Pandas定义 ...

  6. SQL server安装连接

    原文:https://blog.csdn.net/andrewniu/article/details/78485312 原文:https://jingyan.baidu.com/article/76a ...

  7. 如何弹出QQ临时对话框实现不添加好友在线交谈效果

    如何不添加好友弹出QQ临时对话框实现在线交谈效果,这样的一个需求,我们真的是太需要了,实现起来也很简单,一行代码即可搞定,需要的朋友可以参考下 其实这个很简单,在img我们加入一个a标签,然后 < ...

  8. Drupal使用

    首先到https://www.drupal.org/download去下载Drupal 更好的办法是使用composer,这个先放着,了解后再添加 然后将解压后的文件夹整个复制到设置的部署路径下,因为 ...

  9. Block abstraction view(Create & Reference)

    在hierarchical design 中,一般需要调用 hard macro,top调用 macro 的方法有多种: 1. 调用macro对应的db 2. 调用 macro 的 ilm 模型(20 ...

  10. visual studio 插件

    一:VS10x Code Map(打开后台cs文件,插件列出了所有的字段.方法,方便当代码行多的时候查找,提升工作效率) 1:下载 https://marketplace.visualstudio.c ...