zoukankan      html  css  js  c++  java
  • git从ssh到提交到github


    1、安装 Git 客户端 yum install git 

    2、打开 Git Bash,开始键入用户信息,和github通讯用的,不能乱写:

    git config --global user.name "You Name"
    git config --global user.email yourmail@server.com
    git config --global color.ui true   //这一条主要是为不同状态添加不同颜色。


    第二步:注册 GitHub,配置相关信息

    1、成功注册 GitHub 帐号后,创建 GitHub SSH密匙,Git Bash 下键入命令:

    ssh-keygen -C 'yourmail@server.com' -t rsa
    2、回到 GitHub 个人首页,点击 Account Settings -> SSH Public Keys -> Add another public key。title 可以随便取名字,Key 里面添加的内容为 id_rsa.pub 文件内所有的代码。然后点击 Apply 即可。

    测试与 GitHub 是否连接成功:ssh git@github.com

    如果输出下面内容,表示连接成功了。

    PTY allocation request failed on channel 0
    Hi USER_NAME! You've successfully authenticated, but GitHub does not provide shell access.
    Connection to github.com closed.


    3、可以在 GitHub 上添加第一个空的 Git 仓库 ,假设为test
    4、用git clone将刚刚建立的仓库,克隆到本地。

    git@github.com:xxx/test.git

    5、将需要的文件拷贝到本地仓库内。

    6、运行一下git  status查看一下,你会发现许多刚刚加入的文件。

    7、运行 git add . 将需要的文件全部添加到git库中。

    8、提交。 git commit -m 'first commit' 

    9、推送到github。 git push

    10、备注,git会在每个仓库中添加一个 .git 隐藏文件夹来保存git的信息和配置文件,仔细阅读会有很多收获。git的全局配置文件,在用户目录下的 .gitconfig 文件中。

  • 相关阅读:
    PE文件捆绑实现二:(远程线程注入)
    C++中Vector清空
    ttrss更新到最新版本后发访问非80和443端口规避
    Git配置https_proxy访问github失败
    Haproxy配置拦截指定src的连接
    synology git管理程序添加
    ActiveMQ深入浅出系列 (一)
    sl4fj日志级别
    HTTP上传文件解析
    linux下jcmd无法获取jvmdump
  • 原文地址:https://www.cnblogs.com/litifeng/p/5597564.html
Copyright © 2011-2022 走看看