Linux上安装和部署git
本机环境:
[git@rhel-server .ssh]$ cat /proc/version
Linux version 2.6.32-358.el6.x86_64
1.安装
yum install git
[git@rhel-server hello.git]$ yum list git
已加载插件:fastestmirror, product-id, subscription-manager
Determining fastest mirrors
已安装的软件包
git.x86_64 1.7.1-9.el6_9
2.初始化配置
git config --global user.name laoxu
git config --global user.email 123@example.com
3.创建git用户
sudo adduser git
su git
cd
mkdir .ssh && chmod 700 .ssh
touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
4.打开RSA认证
4.1.修改配置文件
[git@rhel-server .ssh]$ sudo vim /etc/ssh/sshd_config
找到以下几行,把注释去掉
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
4.2.生成公钥【客户端】
$ ssh-keygen
一路回车默认即可。
ACER@luohanye MINGW64 ~/.ssh
$ ls
id_rsa id_rsa.pub known_hosts
4.3.上传到git服务器:
scp id_rsa.pub git@192.168.56.101:/home/git/keys/indexman.pub
将id_rsa.pub中内容复制到authorized_keys文件:【服务端】
[git@rhel-server .ssh]$ cat indexman.pub >>../.ssh/authorized_keys
4.4.本地clone git仓库
无需输入密码。
$ git clone git@192.168.56.101:/home/git/projects/hello.git
Cloning into 'hello'...
remote: Counting objects: 26, done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 26 (delta 2), reused 0 (delta 0)
Receiving objects: 100% (26/26), 6.16 KiB | 0 bytes/s, done.
Resolving deltas: 100% (2/2), done.
5.客户机clone仓库【客户端】
[root@rhel-server ~]# ssh git@192.168.56.101
The authenticity of host '192.168.56.101 (192.168.56.101)' can't be established.
RSA key fingerprint is b6:9a:24:cf:e7:d5:dc:f5:bb:66:13:9a:fe:f4:15:11.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.56.101' (RSA) to the list of known hosts.
git@192.168.56.101's password:
6.配置git服务器,初始化裸仓库
[git@rhel-server projects]$ mkdir hello.git
[git@rhel-server projects]$ cd hello.git/
[git@rhel-server hello.git]$ git init --bare
7.将本地项目上传至git服务器【客户端】
切换到本地项目目录:例如 e:\ideaprojects\hello
git init
git add .
git commit -m 'init'
git remote add origin git@192.168.56.101:/home/git/projects/hello.git
git push origin master
git@192.168.56.101's password:
8.或是克隆已有的git仓库【客户端】
切换到指定目录:例如 d:\test
$ git clone git@192.168.56.101:/home/git/projects/hello.git
Linux上安装和部署git的更多相关文章
- Jira在linux上安装与部署
Where should JIRA 6.0.1 be installed? [/opt/atlassian/jira] /usr/local/jira Default location for JIR ...
- Kibana在Linux上安装部署及使用说明
Kibana安装及使用说明 Kibana是一个针对Elasticsearch的开源分析及可视化平台,用来搜索.查看交互存储在Elasticsearch索引中的数据. 官方地址:https://www. ...
- Linux上安装git
Linux上安装git Git是一个开源的分布式版本控制系统,可以有效.高速的处理从很小到非常大的项目版本管理. 而国外的GitHub和国内的Coding都是项目的托管平台.但是在使用Git工具的时候 ...
- 怎么在linux上安装部署jenkins
怎么在linux上安装部署jenkins 作为一个非科班出身自学的小白,踩过很多的坑,特此留下记录 以下在虚拟机上示例 系统:linux(centos7) 操作方式:xshell连接终端操作 教程之前 ...
- WINDOWS和Linux上安装php7 alpha 并安装 yaf
WINDOWS和Linux上安装php7 alpha 并安装 yaf PHP技术 widuu 2个月前 (06-15) 126浏览 0评论 windows 1.windows上安装 php7 ...
- linux上安装配置samba服务器
linux上安装配置samba服务器 在linux上安装配置samba服务器 在这给大家介绍一个不错的家伙,samba服务.如果您正在犯愁,如何在Windows和Linux之间实现资源共享,就请看看这 ...
- 在linux上安装dotnetcore
dotnet core已经出来有一段时间了,不是什么新名词了.但这个技术,目前还是比较新的,企业也没有普遍应用.它最大的亮点就是跨平台,也就是我们写的c#代码,可以运行在linux上. 在国内学习do ...
- [Zephyr] 1、在linux上安装Zephyr-OS并跑DEMO
星期五, 14. 九月 2018 02:18上午 - BEAUTIFULZZZZ 0) 前言 Zephyr™项目是一个采用Apache 2.0协议许可,Linux基金会托管的协作项目.为所有资源受限设 ...
- 在linux上安装spark详细步骤
在linux上安装spark ,前提要部署了hadoop,并且安装了scala. 提君博客原创 对应版本 >>提君博客原创 http://www.cnblogs.com/tijun/ ...
- 如何在Cent OS上安装和部署jdk与tomcat?
Cent OS是一款Linux系统.在商业应用中,Linux操作系统在服务器市场有着广泛的运用,这源于Linux系统的几大优点: 1.跨平台的硬件支持 由于Linux 的内核大部分是用C 语言编写的, ...
随机推荐
- [转帖]MySQL 8.2.0 GA
https://cloud.tencent.com/developer/article/2353798 MySQL新的进化版8.2.0于2023年10月25日发行,让我们一起快速浏览一下该版本发生哪些 ...
- [转帖]Shell编程规范与变量
目录 一.Shell的概念 Shell脚本的概念 Shell脚本应用场景 二.Shell的作用 Shell脚本种类 shell脚本的作用 Shell脚本的构成 Shell脚本的构成 二.编写Shell ...
- [转帖]Fluentd 的优缺点
https://zhuanlan.zhihu.com/p/129375187 以前在不少场合浅度使用过 Fluentd,将日志汇聚到一个地方.它给我的大体印象是 简单且能解决问题 直到最近遇到一个 ...
- [转帖]Jmeter插件之ServerAgent服务器性能监控工具的安装和使用
https://www.cnblogs.com/pachongshangdexuebi/p/13354201.html 一.前言 性能测试时我们关注的重要指标是:并发用户数,TPS,请求成功率, ...
- [转帖]看看 Jmeter 是如何玩转 redis 数据库的
柠檬小欧 2021-08-31 20:06420 Jmeter 作为当前非常受欢迎的接口测试和性能测试的工具,在企业中得到非常广泛的使用,而 Redis 作为缓存数据库,也在企业中得到普遍使用,那如何 ...
- 【转帖】Alpaca 7B:斯坦福从LLaMA-7B微调的语言模型
https://www.jianshu.com/p/f8f8f660d2c3 https://crfm.stanford.edu/2023/03/13/alpaca.html https://crfm ...
- Redis labs 的安装
Install and setup This guide shows how to install Redis Enterprise Software, which includes several ...
- js循环之map在工作中的使用
map函数会返回一个全新的数组哈(重要 在实际中很有用) map循环空那个数组时,不会报错的. 使用map的优势 可以返回一个全新的数组 可以用于过滤 ps==>:map里面不要有判断,否者会返 ...
- es6 Array.form将类数组或者对象转化为数组
Array.from()方法就是将一个[类数组对象][或者可遍历对象]转换成一个[真正的数组] 那么什么是类数组对象呢?所谓类数组对象,最基本的要求就是具有length属性的对象. let array ...
- HTML超链接自定义颜色
先添加一个css样式 我这里直接内嵌了因为代码量比较少不会影响太大的性能 <style type="text/css"> body {background-color: ...