git上有哪些html源码,使用gitlab管理网站源代码

1、新建项目:

新建项目钱,先创建项目所在的组(也就是说这个项目文件是保存在那个组里)

新建组:

fb31f4048633d1f6fe04138682c934de.png

bc489294dfe3ff02e121fbc591038ee7.png

2d83a02807b79263055de2b7c8f14abe.png

1b43b9d87699f2e5ad43676553eca2c2.png

打开项目地址:

http://172.16.0.10/poweroff/poweroff-web.git

2、新建用户

ac006f202082c95d3389f04e33e6fc63.png

2f2d3e7b302e407fc342f404641a382e.png

可以点击编辑进行手动配置密码

452451725b5c7cc2264c2235ffccb95c.png

打开qq邮箱查收邮件,如果收不到邮件,请看下一步

53ed2f89f1c2e1303b684fa3cbfd0075.png

或者administartor进行重置密码。告诉你,你在直接修改。

e5367b102868bc5ea0cee036d972fcdc.png

测试登录:退出root用户使用新建用的邮箱或者用户名登录

8c5e00f9ffdc54809f6d40a8867aeafc.png

修改密码

ce748c0a7d761e95ef14239b15e69f52.png

测试:添加一个文件:

716915c1f24bfe53fe046c3ea6b39e01.png

6e8bea83831f65c58d5e3458cfb33e80.png

011c75e5bcf2dc9d74d78634a41526b8.png

3、删除用户:

当员工离职,为了安全起见避免机密文件丢失需要删除用户。

12c02e3b06ad8995951c948043c1fca1.png

4、客户端git使用:

[root@site ~]# git clone http://172.16.0.10/poweroff/poweroff-web.git

Cloning into 'poweroff-web'...

remote: Counting objects: 3, done.

remote: Total 3 (delta 0), reused 0 (delta 0)

Unpacking objects: 100% (3/3), done.

[root@site ~]# ll poweroff-web/

total 4

-rw-r--r-- 1 root root 15 Apr 29 16:11 index.html

初次运行git前的配置

一般在新的系统上,都需要先配置下自己的git工作环境。配置工作只需要一次,以后升级时还会沿用现在的配置。

第一个要配置的是你的个人用户名称和电子邮件地址,这两条配置很重要,每次gie提交时都会引用这两条信息,说明是谁提交了更新,所以会随更新内容一起被永久纳入历史记录。

给运行环境变量有点像.bashrc,决定了git在各个环节的具体工作方式和行为。这些变量可以存放在一下两个地方。

1:~/.gitconfig文件:用户目录下配置文件只适用于该用户,若使用git config时用--global选项,读写的就是这个文件。

例1:

[root@site ~]# git config --global user.name "zhangsong"

[root@site ~]# git config --global user.email "4409749@qq.com"

[root@site ~]# cat /root/.gitconfig

[user]

name = zhangsong

email = 4409749@qq.com

当前项目的git目录中的配置文件(也就是工作目录中的.git/config文件):这里的配置仅仅针对当前项目有效。每一个级别的配置都会覆盖上层的相同配置,所以.git/config里的配置会覆盖~/.gitconfig中的同名变量。

如果要在某个特定的项目中使用其他名字或者邮件地址,先进入到项目下,然后去掉--global选项重新配置即可,最后配置的用户和邮件地址会保存在当前项目的.git/congif文件里。

[root@site ~]# ls poweroff-web/ -a

. .. .git index.html

[root@site ~]# ls poweroff-web/.git/

branches config description HEAD hooks index info logs objects packed-refs refs

[root@site ~]# git config user.name "zh" #直接修改提示失败。

error: could not lock config file .git/config: No such file or directory

[root@site ~]# cd poweroff-web/

[root@site poweroff-web]# git config user.name "zh"

[root@site poweroff-web]# git config user.email "zh.163.com"

5、Git常用命令

git config --global user.name “name” #设置全局用户名

git config --global user.email “mail” #设置全局邮箱

git config –global –list #列出用户全局设置

git add index.html #添加文件到暂存区

git commit -m “描述的内容” #提交文件到工作区,并没有提交到库里

git status #查看工作区的状态

git push #提交代码到git服务器

git pull #获取代码到本地

git log #查看操作日志

vim .gitignore #定时忽略文件

git reset –hard HRAD^ #git版本回滚,HEAD为当前版本。加上一个^为上一个,^^为上上一个版本

git reflog #获取每次提交的ID,可以使用—hard根据提交的ID进行版本回退

git reset --hard id号#回退到指定id版本

git branch #查看当前所处的分支

git chechout --file #从服务器更新某个文件覆盖本地文件

6、修改index.html文件更新到主版本中

[root@site poweroff-web]# touch readme.txt

[root@site poweroff-web]# git add readme.txt

[root@site poweroff-web]# git commit -m "add readme.txt"

[master d5843cf] add readme.txt

1 file changed, 0 insertions(+), 0 deletions(-)

create mode 100644 readme.txt

[root@site poweroff-web]# git push -u origin master

Username for 'http://172.16.0.10': zhangsong

Password for 'http://zhangsong@172.16.0.10':

Counting objects: 4, done.

Compressing objects: 100% (2/2), done.

Writing objects: 100% (3/3), 265 bytes | 0 bytes/s, done.

Total 3 (delta 0), reused 0 (delta 0)

To http://172.16.0.10/poweroff/poweroff-web.git

c4625e3..d5843cf master -> master

Branch master set up to track remote branch master from origin.

web端查看

0657d87f589285037484322b53a6f999.png

7、误删除恢复:

[root@site poweroff-web]# rm -rf index.html

[root@site poweroff-web]# ls

readme.txt

[root@site poweroff-web]# git checkout

Dindex.html

[root@site poweroff-web]# git reset --hard HEAD

HEAD is now at d5843cf add readme.txt

[root@site poweroff-web]# ls

index.html readme.txt

查看版本

[root@site poweroff-web]# git --version

git version 1.8.3.1

获取每次提交的id

[root@site poweroff-web]# git reflog

d5843cf HEAD@{0}: commit: add readme.txt

c4625e3 HEAD@{1}: clone: from http://172.16.0.10/poweroff/poweroff-web.git

8、工作区和暂存区及分支概述

1:工作区就是编辑文件的目录区域,需要将工作区的修改好的文件add到暂存区才能提交到git服务器,在工作区有多个文件的时候可以将一个或多个文件添加至暂存区,再提交到git服务器即可。

2:在服务器创建分支

[root@site poweroff-web]# git branch bbs #创建分支

[root@site poweroff-web]# git checkout bbs#切换到分支bbs

Switched to branch 'bbs'

[root@site poweroff-web]# git branch #查看当前再哪一个分支

* bbs

master

[root@site poweroff-web]# echo "1234567890" >> a.txt #随便追加内同

[root@site poweroff-web]# ls

a.txt index.html readme.txt

[root@site poweroff-web]# git add a.txt #

[root@site poweroff-web]# git commit -m 'add a.txt'#

[bbs 030464a] add a.txt

1 file changed, 1 insertion(+)

create mode 100644 a.txt

[root@site poweroff-web]# git push -u origin bbs#上传到分支bbs

Username for 'http://172.16.0.10': zhangsong

Password for 'http://zhangsong@172.16.0.10':

Counting objects: 4, done.

Compressing objects: 100% (2/2), done.

Writing objects: 100% (3/3), 310 bytes | 0 bytes/s, done.

Total 3 (delta 0), reused 0 (delta 0)

remote:

remote: To create a merge request for bbs, visit:

remote: http://gitlab.example.com/poweroff/poweroff-web/merge_requests/new?merge_request%5Bsource_branch%5D=bbs

remote:

To http://172.16.0.10/poweroff/poweroff-web.git

* [new branch] bbs -> bbs

Branch bbs set up to track remote branch bbs from origin.

2f168bfff1f30637f279ea78eaeaeef7.png

d4781aa57f5a68ecedee7544a589c96d.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值