NO.A.0004——Git私有服务器部署/makefile方式/本地与Git服务器代码交换
远程仓库实际上和本地仓库没啥不同,纯粹为了7x24小时开机并交换大家的修改。GitHub就是一个免费托管开源代码的远程仓库。但是对于某些视源代码如生命的商业公司来说,既不想公开源代码,又舍不得给GitHub交保护费,那就只能自己搭建一台Git服务器作为私有仓库使用。
1、环境准备:
[root@localhost ~]# yum -y install curl curl-devel zlib-devel openssl-devel perl cpio expat-devel gettext-devel
>gcc gcc-c++ autoconf perl-ExtUtils-MakeMaker package
Installed:
expat-devel.x86_64 0:2.1.0-12.el7 gcc.x86_64 0:4.8.5-44.el7
gcc-c++.x86_64 0:4.8.5-44.el7 gettext-devel.x86_64 0:0.19.8.1-3.el7
libcurl-devel.x86_64 0:7.29.0-59.el7_9.1
openssl-devel.x86_64 1:1.0.2k-19.el7 zlib-devel.x86_64 0:1.2.7-18.el7
Dependency Installed:
cpp.x86_64 0:4.8.5-44.el7 gettext-common-devel.noarch 0:0.19.8.1-3.el7
git.x86_64 0:1.8.3.1-23.el7_8 glibc-devel.x86_64 0:2.17-317.el7
glibc-headers.x86_64 0:2.17-317.el7 kernel-headers.x86_64 0:3.10.0-1160.6.1.el7
keyutils-libs-devel.x86_64 0:1.5.8-3.el7 krb5-devel.x86_64 0:1.15.1-50.el7
libcom_err-devel.x86_64 0:1.42.9-19.el7 libkadm5.x86_64 0:1.15.1-50.el7
libmpc.x86_64 0:1.0.1-3.el7 libselinux-devel.x86_64 0:2.5-15.el7
libsepol-devel.x86_64 0:2.5-10.el7 libstdc++-devel.x86_64 0:4.8.5-44.el7
libverto-devel.x86_64 0:0.2.5-4.el7 mpfr.x86_64 0:3.1.1-4.el7
pcre-devel.x86_64 0:8.32-17.el7 perl-Error.noarch 1:0.17020-2.el7
perl-Git.noarch 0:1.8.3.1-23.el7_8 perl-TermReadKey.x86_64 0:2.30-20.el7
Updated:
cpio.x86_64 0:2.11-28.el7 curl.x86_64 0:7.29.0-59.el7_9.1
perl.x86_64 4:5.16.3-297.el7
Dependency Updated:
e2fsprogs.x86_64 0:1.42.9-19.el7 e2fsprogs-libs.x86_64 0:1.42.9-19.el7 expat.x86_64 0:2.1.0-12.el7
glibc.x86_64 0:2.17-317.el7 glibc-common.x86_64 0:2.17-317.el7 krb5-libs.x86_64 0:1.15.1-50.el7
libcom_err.x86_64 0:1.42.9-19.el7 libcurl.x86_64 0:7.29.0-59.el7_9.1
libgcc.x86_64 0:4.8.5-44.el7 libgomp.x86_64 0:4.8.5-44.el7 libss.x86_64 0:1.42.9-19.el7
libstdc++.x86_64 0:4.8.5-44.el7 perl-libs.x86_64 4:5.16.3-297.el7
Complete!
//2、下载Git-2.5.0版本并解压tar包生成makefire:
[root@localhost ~]# wget https://www.kernel.org/pub/software/scm/git/git-2.5.0.tar.gz
[root@localhost ~]# tar -zxvf git-2.5.0.tar.gz
[root@localhost git-2.5.0]# autoconf
[root@localhost git-2.5.0]# ./configure prefix=/usr/local/git/ //生成makefile
//3、make && make install
[root@localhost git-2.5.0]# make
GEN bin-wrappers/test-wildmatch
GEN git-remote-testgit
[root@localhost git-2.5.0]# make install
hatchanged; do \
rm -f "$execdir/$p" && \
test -z "" && \
ln "$execdir/git" "$execdir/$p" 2>/dev/null || \
ln -s "git" "$execdir/$p" 2>/dev/null || \
cp "$execdir/git" "$execdir/$p" || exit; \
done && \
remote_curl_aliases="git-remote-https git-remote-ftp git-remote-ftps" && \
for p in $remote_curl_aliases; do \
rm -f "$execdir/$p" && \
test -z "" && \
ln "$execdir/git-remote-http" "$execdir/$p" 2>/dev/null || \
ln -s "git-remote-http" "$execdir/$p" 2>/dev/null || \
cp "$execdir/git-remote-http" "$execdir/$p" || exit; \
done && \
./check_bindir "z$bindir" "z$execdir" "$bindir/git-add"
//4、配置生效文件及软连接:
[root@localhost git-2.5.0]# vim /etc/profile //将git指令添加到bash中
export PATH=$PATH:/usr/local/git/bin //在profile中添加该内容
[root@localhost git-2.5.0]# source /etc/profile //使配置文件生效
[root@localhost ~]# ln -s /usr/local/git/bin/git /usr/bin/ //创建软连接
[root@localhost git-2.5.0]# git -version
git version 2.5.0
//5、添加用户
[root@localhost ~]# adduser -r -c 'git version control' -d /home/git -m git
//此命令执行后会创建/home/git目录作为git用户的主目录。
[root@localhost ~]# passwd git //为git用户创建密码
[root@localhost ~]# su git //切换到git用户之下
//6、创建repo1仓库
[git@localhost ~]$ git --bare init /home/git/repo1
Initialized empty Git repository in /home/git/repo1/ //创建git仓库repo1.并初始化仓库。推荐使用git --bare init
//如果不使用“--bare”参数,初始化仓库后,提交master分支时报错。
//这是由于git默认拒绝了push操作,需要.git/config添加如下代码:
[receive]
denyCurrentBranch = ignore
[git@localhost ~]$ ls
repo1 //查看服务器上的远程仓库创建完成。
//在本地电脑:右键——>Git Bash Here
$ git remote add origin ssh://git@192.168.1.60/home/git/repo1
//使用命令与远程服务器建立连接
// 私有git服务器搭建完成后就可以向连接github一样连接使用了,
//但是我们的git服务器并没有配置密钥登录,所以每次连接时需要输入密码。
//这种形式和刚才使用的形式好像不一样,前面有ssh://前缀,也可以这样执行
$ git remote add origin git@192.168.1.60:repo1
- 在.git的工作目录之下——>右键——>git同步——>远端URL:管理——>远端:private-git——>URL: ssh://git@192.168.1.60/home/git/repo1——>保存——>推送:服务器用户名:密码——>推送完成——>在Git服务器远程仓库就可查看到仓库文件——>END
[git@localhost ~]$ ls repo1/
branches config description HEAD hooks info objects refs
- 右键——>Git 克隆——>URL: ssh://git@192.168.1.60/home/git/repo1——>目录:E:\NO.2——GitHub Repository\Repository\clone-repos\repo1——>用户名:密码——>克隆完成——END
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
<wiz_marker id="wiz-painter-root" style="">
NO.A.0004——Git私有服务器部署/makefile方式/本地与Git服务器代码交换的更多相关文章
- git远程删除分支后,本地执行git branch -a依然能看到删除分支到底该咋整?
使用命令git branch -a可以查看所有本地分支和远程分支(git branch -r 可以只查看远程分支) 如果发现很多在远程仓库已经删除的分支在本地依然可以看到到底该怎么办呢?(反正强迫症受 ...
- win端git连接私服仓库+上传本地项目+从服务器下载文件到win
win端git连接私服仓库: 1.win端 检查c:/Users/用户/.ssh/目录下是否有config文件(!!!没有任何后缀名).如果没有则新建config文件,然后修改添加如下内容: Host ...
- ubuntu使用ssh远程登录服务器及上传本地文件到服务器
1. ubuntu 远程登录 首先你的ubuntu要能够支持ssh,如果不能,自行百度! 打开终端,输入 ssh root@115.159.200.13(你的服务器的IP地址) 回车就会让你输入 ...
- Nginx + Tomcat 反向代理 如何在高效的在一台服务器部署多个站点
上一篇分享了 Nginx + Tomcat 反向代理 负载均衡 集群 部署指南,感觉还是相当实用型的,但是一般集群部署是基于大访问量的,可能有的企业用不到,类似一些企业官网,访问量并不是很大,基于这个 ...
- Git 系列(一):什么是 Git
欢迎阅读本系列关于如何使用 Git 版本控制系统的教程!通过本文的介绍,你将会了解到 Git 的用途及谁该使用 Git. 如果你刚步入开源的世界,你很有可能会遇到一些在 Git 上托管代码或者发布使用 ...
- git 查看、创建、删除 本地,远程 分支
1. 查看远程分支 git branch -rorigin/master 2. 查看本地分支 git branch *master 注:以*开头指明现在所在的本地分支 3. 查看本地分支和远程分支 g ...
- 一步搞定私有Git服务器部署(Gogs)
http://www.jianshu.com/p/424627516ef6 零.安装 Docker 和 Compsoe 首先安装 Docker: $ curl -sSL https://get.doc ...
- 使用git代替FTP部署代码到服务器的例子
这篇文章主要介绍了使用git代替FTP部署代码到服务器的例子,这种方法可以节省流量.节省时间,需要的朋友可以参考下 本地开发完成后,通常会在服务器上部署,有人会使用ftp,有人会使用scp, ftp和 ...
- 如何使用git和ssh部署本地代码到服务器
一.首先设置好自己本地的Git用户名和密码: git config --global user.name "your name" git config --global user. ...
随机推荐
- Linux命令行bash的快捷键
提升效率 锁屏 Ctrl + s 敲什么命令没反应,但是敲上去了,屏幕上不做任何反应 Ctrl + q 再解锁 例如: 先Ctrl + s 锁屏 然后在命令行敲入 [root@C8-1 ~]# rm ...
- vue 路由工程化重构
当项目越来越庞大的时候,路由越来越多,而且遍布的页面也越来越多, 当需要更换地址的时候就无比的繁琐,通过学习了解到可以通过router.js来统一调控 原理: 在路由页面通过name来进行跳转,传入的 ...
- matplotlib中plt用法实例
import torch from models.models import Model import cv2 from PIL import Image import numpy as np fro ...
- requests 库和beautifulsoup库
python 爬虫和解析 库的安装:pip install requests; pip install beautifulsoup4 requests 的几个常用方法: requests.reques ...
- Go语言的互斥锁Mutex
目录 一.使用方法 二.死锁场景 1.Lock/Unlock不是成对出现 2.锁被拷贝使用 3.循环等待 一.使用方法 Mutext是互斥锁的意思,也叫排他锁,同一时刻一段代码只能被一个线程运行,两个 ...
- Scrapy加Redis加IP代理池实现音乐爬虫
音乐爬虫 关注公众号"轻松学编程"了解更多. 目的:爬取歌名,歌手,歌词,歌曲url. 一.创建爬虫项目 创建一个文件夹,进入文件夹,打开cmd窗口,输入: scrapy star ...
- UML类图关系表示
UML 之 C++类图关系全面剖析 分类: 软件设计与架构2008-10-16 08:52 5165人阅读 评论(3) 收藏 举报 umlc++borderclasscblog UML的类图关系分为: ...
- ZOJ 1006 Do the Untwish
Do the Untwish 题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1006 题意:给定密文按公式解密 注 ...
- logback日志打印sql
今天整合springboot2 + mybatis + logback 遇到了在日志中sql打印不出来的坑,在网上找了好久,都不是我遇到的问题,这里吐槽一下下现在的博客质量,好多都是抄袭的,也没有标注 ...
- fflush(stdin)和fflush(stdout)
转自:http://blog.csdn.net/yeyuangen/article/details/6743416 fflush(stdin)即清理标准输入流,把多余的仍未被保存的数据丢掉. fflu ...