zoukankan      html  css  js  c++  java
  • GITHUB(github)初级使用

    Github顾名思义是一个Git版本库的托管服务,是目前全球最大的软件仓库,拥有上百万的开发者用户,也是软件开发和寻找资源的最佳途径,Github不仅可以托管各种Git版本仓库,还拥有了更美观的Web界面,您的代码文件可以被任何人克隆,使得开发者为开源项贡献代码变得更加容易,当然也可以付费购买私有库,这样高性价比的私有库真的是帮助到了很多团队和企业

    github使用 

    1、注册用户                   
    2、配置ssh‐key
    3、创建项目
    4、克隆项目到本地
    5、推送新代码到github
    

    注册:

    进入github官网:https://github.com/

    [root@localhost git_data]# git remote
    origin
    [root@localhost git_data]# touch a.txt
    [root@localhost git_data]# touch b.txt
    [root@localhost git_data]# touch c.txt
    [root@localhost git_data]# git add .
    [root@localhost git_data]# git commit -m "add abc.txt"
    [master (root-commit) 5c3255e] add abc.txt
     3 files changed, 0 insertions(+), 0 deletions(-)
     create mode 100644 a.txt
     create mode 100644 b.txt
     create mode 100644 c.txt
    [root@localhost git_data]# git status
    # On branch master
    nothing to commit, working directory clean
    [root@localhost git_data]# git remote remove origin
    [root@localhost git_data]# git remote
    [root@localhost git_data]# git remote add origin git@github.com:chinansh/github.git
    [root@localhost git_data]# git remote
    origin
    [root@localhost git_data]# git push -u origin master
    The authenticity of host 'github.com (13.229.188.59)' can't be established.
    RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
    RSA key fingerprint is MD5:16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'github.com,13.229.188.59' (RSA) to the list of known hosts.
    Counting objects: 3, done.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (3/3), 207 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    To git@github.com:chinansh/github.git
     * [new branch]      master -> master
    Branch master set up to track remote branch master from origin.
    [root@localhost git_data]# git status
    # On branch master
    nothing to commit, working directory clean
    [root@localhost git_data]# ll
    total 0
    -rw-r--r--. 1 root root 0 Apr 17 21:44 a.txt
    -rw-r--r--. 1 root root 0 Apr 17 21:44 b.txt
    -rw-r--r--. 1 root root 0 Apr 17 21:45 c.txt
    

      

     

    [root@localhost data]# git clone git@github.com:chinansh/github.git
    Cloning into 'github'...
    Warning: Permanently added the RSA host key for IP address '52.74.223.119' to the list of known hosts.
    remote: Enumerating objects: 3, done.
    remote: Counting objects: 100% (3/3), done.
    remote: Compressing objects: 100% (2/2), done.
    remote: Total 3 (delta 0), reused 3 (delta 0), pack-reused 0
    Receiving objects: 100% (3/3), done.
    [root@localhost data]# ll
    total 0
    drwxr-xr-x. 3 root root 57 Apr 17 21:58 github
    [root@localhost data]# cd github/
    [root@localhost github]# ll
    total 0
    -rw-r--r--. 1 root root 0 Apr 17 21:58 a.txt
    -rw-r--r--. 1 root root 0 Apr 17 21:58 b.txt
    -rw-r--r--. 1 root root 0 Apr 17 21:58 c.txt
    

      

    [root@git git_test]# touch d
    
    [root@git git_test]# git add .
    [root@git git_test]# git commit ‐m "add	d"	
    [root@git git_test]# git push	‐u origin master	
    [root@git git_data]# cd /root/git_data/	# 拉取远程仓库最新代码、然后进行上传	
    [root@git git_data]# git pull			
    

      

  • 相关阅读:
    [置顶] 内外网同时访问,我的拿来主义
    Nginx防攻击工具教程一 ngx_http_limit_conn_module
    晒晒我的厨艺修炼成果
    在 javascript 中,为什么 [1,2] + [3,4] 不等于 [1,2,3,4]?
    无法解析的外部符号__imp__AlphaBlend@44的解决
    Win32 API实现CDC类的FillSolidRect接口
    pugixml库学习之添加节点
    cleanup failed because the file not under version control问题的解决
    JavaScript 的 typeof 的用途
    支持在Win7和XP系统上创建环境变量的批处理文件
  • 原文地址:https://www.cnblogs.com/nshgo/p/10726516.html
Copyright © 2011-2022 走看看