1.githup网站创建new repository

2.执行下面命令,找到本地用户公钥地址

ssh -v git@github.com
输出:
debug1: Offering RSA public key: /c/Users/xiao/.ssh/id_rsa $ cd /c/Users/xiao/.ssh/ xiao@XIAO MINGW64 ~/.ssh
$ ll
total 9
-rw-r--r-- 1 xiao 1049089 1675 5月 21 2018 id_rsa
-rw-r--r-- 1 xiao 1049089 407 5月 21 2018 id_rsa.pub
-rw-r--r-- 1 xiao 1049089 1219 3月 22 16:44 known_hosts

大多数 Git 服务器都会选择使用 SSH 公钥来进行授权。系统中的每个用户都必须提供一个公钥用于授权,没有的话就要生成一个。生成公钥的过程在所有操作系统上都差不多。 首先先确认一下是否已经有一个公钥了。SSH 公钥默认储存在账户的主目录下的 ~/.ssh 目录。进去看看:

$ cd ~/.ssh
$ ls
authorized_keys2 id_dsa known_hosts
config id_dsa.pub

id_dsa.pub文件就是公钥,id_dsa文件则是密钥,假如没有这些文件,或者干脆连 .ssh 目录都没有,可以用 ssh-keygen 来创建。

所有做过这一步的用户都得把它们的公钥给你或者 Git 服务器的管理员(假设 SSH 服务被设定为使用公钥机制)。他们只需要复制 .pub 文件的内容然后发邮件给管理员。公钥的样子大致如下:

$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJz6f4VVC5sCDs3Ebhmhi7mO3kU7YWqcoOCPwSt/EyaxZObSaNJpvUxuXlGfYuYeQP65ztCwRZhkQuLp6RZAP4tfEZbYFjU2L9mtH1QdoTA6pqKIhFL5ZJz/etDRtAfNvn1kwK361AsJy4B/GHdx8VVV/Zm0ddwVPLM8UBhdXFSmQotE3H0HnuUUuKQHHfdCq5HXvWnuSzNcjsPbUjTV4IpyPScOweVBROQ+e0H/OtOAh3mTN8ob4q4NJav3mW0iUnIoMS2kMCExGbbSSevuOUL+IeDfHq9VwhIHPqNGJNalKMLZyKbLfOsOZow02Fv xiao@163.com

3.将id_rsa.pub的内容配置到你的github.com在设置里面的ssh keys值

4.测试本地连接github.com

$ ssh -T git@github.com
Hi xxxxx! You've successfully authenticated, but GitHub does not provide shell access.

报上面信息说明连接成功

5.克隆githup new repository到本地

git clone git@github.com:xxxxx/example-project.git

6.将待上传文件放入克隆目录内,上传到git

git add --all
git commit "第一次提交"
git remote set-url origin git@github.com:xxxxx/example-project.git
git push origin master

本地代码上传到githup的更多相关文章

  1. 将本地代码上传至github备份的操作方法

    这篇文章写得是windows下的使用方法. 第一步:创建Github新账户 第二步:新建仓库 第三步:填写名称,简介(可选),勾选Initialize this repository with a R ...

  2. 170821、本地代码上传gitlub

    第一步:建立git仓库 cd到你的本地项目根目录下,执行git命令 git init #初始化项目 第二步:将项目的所有文件添加到仓库中 git add . 或者git add -A #如果想添加某个 ...

  3. 本地代码上传到github

    一,注册Github账号 1.先注册一个账号,注册地址:https://github.com/ 2.登录后,点击start a project 3.创建一个repository name,输入框随便取 ...

  4. 【GitHub】本地代码上传

    本地代码上传GitHub 2019-11-18  20:03:45  by冲冲 1.注册GitHub https://github.com/ 2.安装Git工具 https://git-for-win ...

  5. 将本地代码上传到github

    准备工作上传本地代码到github 准备工作 在github上创建自己的Repository. 安装git,centos的git安装教程. 上传本地代码到github git init git add ...

  6. 将本地代码上传github

    建立本地仓库 1.首先进入text文件夹 cd d:text 首先进入text文件夹 2.执行指令:git init 执行git init 初始化成功后你会发现项目里多了一个隐藏文件夹.git 隐藏的 ...

  7. git基本操作:使用git将本地代码上传到GitHub

    一.创建github repository(仓库) 1.登录GitHub 创建GitHub仓库,首先需要登录GitHub,GitHub网址:https://github.com.如果没有GitHub账 ...

  8. windows本地代码上传github

    1.下载Git工具 https://www.git-scm.com/download/win 2.进到项目目录 cd /dir/dir/dir/file 3.初始化 git init 4.添加远程仓库 ...

  9. 将本地代码上传至github

    注册github账号 https://github.com/ 安装git工具 https://git-for-windows.github.io 1.在github中创建一个项目 2.填写相应信息,点 ...

随机推荐

  1. 使用curl自动签到smzdm

    curl -H 'cookie:urcookies' -e 'http://www.smzdm.com/qiandao/' -k 'https://zhiyou.smzdm.com/user/chec ...

  2. ORA-64379: Action cannot be performed on the tablespace assigned to FastStart while the feature is enabled

    解决方法: 禁止IM FastStart exec DBMS_INMEMORY_ADMIN.FASTSTART_DISABLE();

  3. ORA-12805: parallel query server died unexpectedly ORA-04030 (sort subheap,sort key) 原因排查与解决方法

    今日,某服务器pga调整为30G,_pga_max_size调整为8G之后(原来是2G,但是one passes语句较多,性能太低),执行出现ORA-12805: parallel query ser ...

  4. Tomcat基本

    Tomcat web 应用服务器基础 jdk+tomcat安装 1.运行Tomcat为什么要装jdk? http://blog.sina.com.cn/s/blog_753bc97d0102w5rd. ...

  5. 命令行找不到genstrings问题tip

    问题:初次使用命令行genstrings,提示使用的是命令行工具而非xcode,无法直接使用genstrings. 解决方案:命令行输入sudo xcode-select --switch /Appl ...

  6. mysql57 centos7 使用

    ####### yum repository install #######mysql yum repo http://repo.mysql.com/wget http://repo.mysql.co ...

  7. js 过滤器

    ,,]; ary[] = ; ary.filter(function(x) { return x === undefined; }); // A. [undefined x 7] // B. [0, ...

  8. 第 8 章 容器网络 - 065 - 容器在 Weave 中如何通信和隔离?

    首先在host2 执行如下命令: weave launch 10.12.31.22 这里必须指定 host1 的 IP 10.12.31.22,这样 host1 和 host2 才能加入到同一个 we ...

  9. ONOS架构-系统组件

    系统组件 系统分层 App/core/providers 业务和子系统 一个业务service是有多个组件构成的功能单元,基于各层软件栈提供一个垂直的分片slice,将构成业务service的组件集合 ...

  10. English trip EM2-PE-5A Plan a dinner party Teacher:Lamb

    课上内容(Lesson) # Appetizer   ['æpə'taɪzɚ]  n. 开胃物,开胃食品 spinach salad  菠菜沙拉  # "p" 发b音 gazpac ...