当前位置: 首页 > news >正文

搭建git服务器

1.创建linux账户,创建文件

adduser git
passwd gitpsw
su git
pwd
cd ~/
mkdir .ssh
cd ~/.ssh
touch authorized_keys

2.特别重要(单独起一行),给文件设权限

chmod 700 /home/git/.ssh
chmod 600 /home/git/.ssh/authorized_keys

3.本地生产密钥并把公钥传输到服务端

ssh-keygen -t rsa
rsync id_rsa.pub git@远端ip:/home/git/.ssh

4.将公钥添加到文件

cd /home/git/.ssh/
cat id_rsa.pub >> authorized_keys

5.初始化仓库

mkdir house.git
cd house.git
git init --bare

6.客户端连接git

mkdir clone_house
cd clone_house
git init
touch test
git add test
git commit -m "add test file"
git remote add origin git@git服务器端的ip:house.git
git push -u origin master

其他的,git服务器的默认分支可能叫main不是master;添加密钥的目的是为了免密连接;本文环境客户端mac、服务端ubuntu,其他系统过程一样。

http://www.lryc.cn/news/101950.html

相关文章:

  • 线程中断机制
  • CollectionUtils工具类的使用
  • 基于Nonconvex规划的配电网重构研究(Matlab代码实现)
  • yolo系列笔记(v4-v5)
  • 小白如何高效刷题Leetcode?
  • 使用IDEA打jar包的详细图文教程
  • 《MySQL 实战 45 讲》课程学习笔记(二)
  • 微软亚研院提出模型基础架构RetNet或将成为Transformer有力继承者
  • 探索单例模式:设计模式中的瑰宝
  • Bobo String Construction 2023牛客暑期多校训练营4-A
  • 【React学习】React父子组件通讯
  • NASM汇编
  • 第三章 HL7 架构和可用工具 - 使用 HL7 架构结构页面
  • spring注解驱动开发(一)
  • Vue3搭建启动
  • 阻塞队列(模拟实现)
  • VScode中python的相对路径与绝对路径 FileNotFoundError: [Errno 2] No such file or directory
  • Unity XML2——C#读写XML
  • 带wiringPi库的交叉编译 ---宿主机x86Ubuntu,目标机ARMv8 aarch64(香橙派)
  • 数据仓库基础知识
  • M 芯片的 macos 系统安装虚拟机 centos7 网络配置
  • AcWing 3708. 求矩阵的鞍点
  • web前端开发工程师的具体职责范本(合集)
  • 从源程序到可执行文件的四个过程
  • C++部署学习
  • linux下lazarus开发ide里 BGRAControls控件库comboBox示例
  • Redis学习路线(9)—— Redis的场景使用
  • 糟了,数据库主从延迟了!
  • VUE,子组件给父组件传递参数,props 自定义属性,ref
  • 【Oracle系列】- Oracle数据迁移