下面简单介绍在Centos 7上部署Git 仓库。

一、安装Git及创建用户、配置邮箱

安装git:

# yum install git

创建用户:

(略。。。)

一般单独创建一个git 用户,并禁止用户登录,参考:

https://www.cnblogs.com/shijiaoyun/p/9663396.html

安装完git后配置用户名、邮箱

# git config --global user.name author                              // 将用户名设为author

# git config --global user.email [email protected]     // 将用户邮箱设为[email protected]

二、新建导入一个git 项目

导入一个新的git 项目 (假设 项目代码放在 jes2000下, 一般仓库以.git 结尾,即jes2000.git)

# cd jes2000.git/

# git init

# git add . # 将当前目录下(递归)的文件/文件夹加入git控制

# git commit -m "first commit,Create a repository"    # 提交

# git branch -a ## 查看分支

提交完成后会自动完成创建一个master 分支。

 

也可以将空的仓库,check 到本地(git clone )后,提交代码,并推送到远端自动创建master 分支。

通过 URL: ssh://192.168.226.222:/home/huang/gitrepo/jes2000.git     进行访问、提交。

如果SSH端口号不是默认的 22,这需要在IP 后面跟上具体的IP,

如: git clone ssh://192.168.226.222:19283/home/huang/gitrepo/jes2000.git

Git 之一 Git服务器部署

Git 之一 Git服务器部署

 

 

 

 

 

 

 

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-20
  • 2021-11-13
  • 2022-02-08
  • 2021-09-09
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-06
  • 2021-11-30
  • 2021-12-27
  • 2021-04-26
  • 2021-12-02
相关资源
相似解决方案