ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

分布式版本控制系统GIT使用介绍

2022-03-03 14:31:35  阅读:192  来源: 互联网

标签:status GIT github 仓库 控制系统 git test php 分布式


托管代码方法:搭建服务器托管代码;github|SVN|各云平台托管代码;

GitHub基本概念:github主页,个人主页,仓库主页,仓库repository,收藏star,克隆fork,发起请求pull request,merge合并,watch关注,issue事务;
注意:github服务器在国外,私有仓库收费,以有效邮箱注册;
开源项目贡献方法:新建issue、pull request、

git下载地址:https://git-scm.com/downloads

git工作区域有:
    1、工作区working directory:项目人员在次编写项目文件,如源码等。“git add fileName”即可实现提交文件至暂存区。
    2、暂存区stage:暂时将工作区项目文件保存,并统一提交给git仓库;“git commit -m description”即可实现提交文件至仓库。
    3、仓库repository:最终确定的文件保存到仓库,成为一个新版本,并对所有项目人员可见;
    git status可查看git文件状态;

  

git使用流程:
    1、进入gitbash界面,进行git基本信息设置,用于标记是谁提交文件;
        git config --global user.name 'UserName'             #设置用户名,该用户名在github上唯一;
        git config --global user.email 'UserEmail@**.com'    #设置用户邮箱;
        git config --list
    2、设置github无密钥登陆
        ssh-keygen -t rsa -b 4096 -C “UserEmail@**.com”     #在本地gitbash生成ssh密钥;
        cat ~/.ssh/id_rsa.pub                               #查看公钥,添加至http://github.com;
        ssh -T git@github.com                               #测试是否配置成功;

 

 

    3、创建C:\pro_shop项目文件夹,并初始化该文件夹为git本地仓库;
        mkdir C:\pro_shop
        cd C:\pro_shop
        git init                                            #产生要给.git的隐藏目录;
        ls -a       
        git status                                          #查看git状态;

 

    4、本地仓库测试git:在本地创建文件,提交文件至暂存区stage,提交文件至本地仓库;
        touch 1_test.php
        git status
        git add 1_test.php
        git status
        git commit -m "add 1_test.php"
        git status

    5、本地仓库测试git:在本地修改文件,提交文件至暂存区stage,提交文件至本地仓库;
        echo "<?php 111 ?>" >1_test.php
        git status
        git add 1_test.php
        git status
        git commit -m "add 1_test.php"
        git status

6、本地仓库测试git:删除本地、暂存区、本地仓库文件; 
  rm -rf 1_test.php
  git status
  git rm 1_test.php
  git status
  git commit -m "delete 1_test.php"
  git status

 

    7、github上创建仓库,并复制仓库到本地,git仓库地址:git@github.com:**/***.git;
        git clone git@github.com:**/***.git             #克隆远程仓库至本地;
        ls
        cd test_zcl/
        touch 1_test.php && git add 1_test.php \
            && git commit -m "add 1_test.php to local_repo"
        git status
        git push                                        #推送本地仓库至github远程仓库;

 

 

 

 

 

    9、github发布网站
        1)创建public仓库,名称格式必须为:账户名.github.io;
        2)在“账户名.github.io”仓库下创建index.hmtl,并删除README.md文件;
        3)web浏览器访问http://账户名.github.io;
    10、其他项目发布网站
        1)前提:能访问http://账户名.github.io;
        2)GitHub进行某个项目的仓库主页,进入“setting”页面,在“GitHub Pages”选定web根目录;
        3)web浏览器访问http://账户名.github.io/仓库名;

 

 

 

标签:status,GIT,github,仓库,控制系统,git,test,php,分布式
来源: https://www.cnblogs.com/chalon/p/15955757.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有