zoukankan      html  css  js  c++  java
  • Github教程(0)

    Git下载:https://git-for-windows.github.io/

    我下载的版本是:Git-2.6.3-64-bit.exe

    安装:略 默认选项点击"下一步"即可

    安装完毕后

    1.打开Git Bash

    设置使用Git时候的名字和邮箱地址

    $ git config --global user.name "yourname"
    
    $ git config --global user.email "youremail@email.com"

    2.注册Github账户:https://github.com/

    3.设置SSH Key,在Git Bash中输入:

    ssh-keygen –t rsa –C "github register email"

    注: github register email这里写你在第二步注册Github账户的邮箱地址

    然后按下回车,并设置认证密码(也可不设置)

    回车,会得到两个文件:id_rsa(私有密钥),id_rsa.pub是公开密钥。

    这两个文件默认在C:UsersUsername.ssh目录下

    4.添加公开密钥:

    进入你的Github账户,在右上角选择SettingàSSH keysàAdd SSH key, 其中,Title输入一个名称,在Key处粘贴id_rsa.pub中的内容。

    5.此时就可以用私人密钥和Github进行认证和通信,在Git Bash中输入:

    ssh –T git@github.com

    提示:Are you sure you want to continue connecting (yes/no)?

    输入:yes 回车

    显示:Hi yourname! You've successfully authenticated, but Github does not provide shell access.

    接下来,演示一个Github的HelloWorld示例:

    1. 进入Github账户,点击New repository
    2. Repository name输入Hello
    3. Description项输入一些对仓库的描述信息(选填)
    4. Public/Private选项勾选Public
    5. Initialize this repository with a README 选项选上
    6. 点击Create Repository即可创建一个Repository
    7. 点击进入Hello这个Repository,拷贝这个Repository的Web Address

    8. 将Hello这个Repository clone至本地,打开Git Bash,输入:
      git clone your repository's Web Address 

      提示:repository's Web Address就是上一步骤拷贝的URL

    9. Git Bash输入cd Hello,在Hello目录下增加一个文件,比如T.java
    10. 将T.java添加到暂存区,Git Bash中输入:
      git add T.java 
    11. 提交T.java, Git Bash中输入:
      git commit –m "this is your comment" 

       

    12. Push到Github上的仓库
      git push 

       

      进入Github账户中的Hello Repository,即可查看push进去T.java这个文件

    13. 查看提交日志:
      git log 

       

  • 相关阅读:
    Python使用SMTP模块、email模块发送邮件
    harbor搭建及使用
    ELK搭建-windows
    ELK技术栈之-Logstash详解
    【leetcode】1078. Occurrences After Bigram
    【leetcode】1073. Adding Two Negabinary Numbers
    【leetcode】1071. Greatest Common Divisor of Strings
    【leetcode】449. Serialize and Deserialize BST
    【leetcode】1039. Minimum Score Triangulation of Polygon
    【leetcode】486. Predict the Winner
  • 原文地址:https://www.cnblogs.com/greyzeng/p/5046776.html
Copyright © 2011-2022 走看看