搭建GIT服务器
来源:互联网 发布:智业软件上市 编辑:程序博客网 时间:2024/06/14 08:46
1、开发者的生成公钥
开发者本地进入~/.ssh中执行ssh-keygen命令,会生成id_rsa(私钥)id_rsa.pub(公钥)。
将id_rsa.pub发送至服务器端。
2、架设GIT服务器。
a.创建git组,添加一个git用户并添加至该组中。
adduser git 创建git用户
passwd git 创建git用户的密码,输入两遍(如果不需密码,可以不设)
su git 切换git用户
cd ~ 进入git的家目录
mkdir .ssh 创建ssh配置目录
cd .ssh
将开发者的公钥内容写入authorized_keys文件,一个一行,多个用户多行。也可将用户的公钥发送至git所在服务器,执行命令写入该文件,如下命令。
cat /home/zhangsan/id_rsa.pub >> /home/git/.ssh/authorized_keys
b.在git目录中创建空的仓库
mkdir project1.git project1是你的项目名称,未来开发者clone时,生成的文件目录名字则为该名
cd project1.git
git --bare init 使用 --bare 会生成一个工作目录的仓库,不会看到代码。
c.出于安全考虑,第二步创建的git用户不允许登录shell,这可以通过编辑/etc/passwd文件完成。找到类似下面的一行:
git:x:502:502::/home/git:/bin/bash 改为: git:x:502:502::/home/git:/user/bin/git-shell
3.开发者端
开发者端该有的操作这里就不一一赘述。但要注意的一点是,假如,你的本地服务pull报错或push报错,是服务器端GIT没有配置好,常见报错如下:
bash: git-receive-pack: command not found
fatal: Could not read from remote repository.
以及
bash: git-upload-pack: command not found
fatal: Could not read from remote repository.
解决办法:
需要到服务器端将git-receive-pack和git-upload-pack链接到/usr/bin/中:
ln -s /usr/local/git/bin/git-receive-pack /usr/bin/git-receive-pack
ln -s /usr/local/git/bin/git-upload-pack /usr/bin/git-upload-pack
1 0
- Git服务器 - 搭建git
- Git 搭建Git服务器
- Git之搭建Git服务器
- git教程 搭建GIT服务器
- 自定义Git - 搭建Git服务器
- git服务器搭建
- git服务器搭建
- git服务器搭建
- git服务器搭建过程
- git服务器的搭建
- git服务器的搭建
- git服务器搭建
- git服务器搭建过程
- git服务器的搭建
- 搭建git服务器
- ubuntu搭建Git 服务器
- Git服务器搭建
- git服务器的搭建
- Android 之 activity切换动画
- 织梦DedeCMS完美实现下拉导航菜单
- android 代码片段整理
- 从sap xi生产wsdl文件,客户端怎么做webservice?
- 高德地图定位、添加定位图标、连线(一)
- 搭建GIT服务器
- Performance Tips —— Android 官方文档翻译<二>
- Ajax XMLHttpRequest对象的三个属性以及open和send方法
- SQL Server 数据库定时自动备份
- [YII2] 自定义组件,在YII框架中正常使用
- BeanUtils
- 已知前序中序->构建二叉树
- 内存分配的原理__进程分配内存有两种方式,分别由两个系统调用完成:brk和mmap(不考虑共享内存)
- iOS小demo之屏幕截图