创建虚拟机的流程主要是参考https://blog.csdn.net/weixin_41877978/article/details/99625811 ,这里不做过多的阐述。

一、在创建的过程中需要注意以下三点:

1、在手动分区的时候,可以点击“点这里自动创建他们(C)”,快速创建,也可以手动自己创建。

2、测试自己网络的时候要确保自己的ip是没有被占用的。

3、如果需要连接xshell类似的远程连接软件,要确保自己的ssh配置是打开的。

二、排查自己的ssh是否开启的方法:

1.利用 rmp -qa | grep ssh 命令 查看ssh是否安装;

2.如果没有安装可以利用命令 yum install ssh  安装ssh;

3.安装成功后用命令 ps -ef | grep ssh  启动ssh,出现以下情况说明已经启动;

4.还可以用命令   service sshd start  重启;

5.查看ssh配置文件

6.查看配置是否正确

三、搭建虚拟机中的git。

1、安装 git 和 git-daemon(命令:yum install -y git   和   yum install -y git-daemon)

2、 创建git目录,可以选择自己系统文件夹相对存储剩余较大的文件夹创建。

3、创建git仓库,自己命名(进入到刚才创建的目录里创建仓库)。

4、进入刚才创建的仓库文件中,初始化仓库,使用命令:git --bare init。

初始化命令还有 git init ,但是如果我们是团队协作,多人共同开发的时候,要使用上面的命令初始化,两个命令的具体区别可以自行查阅,这里不做详细解释。

5、修改仓库的mod权限,并设置默认新建的文件和文件夹同属于父目录的用户组。

修改mod权限命令:

chmod 775 test/ -R

设置默认用户组命令:

chmod g+s test -R

set -m g:root:rwx test

6、启动Git deamon服务

到这里,虚拟机中的仓库就已经创建好了,下面介绍怎么使用sourcetree连接仓库并进行操作。

四、使用sourcetree连接虚拟机中创建的仓库。

1、安装sourcetree可视化软件,安装过程不再说明。

2、安装好后,克隆刚才已经创建好的仓库到本地。

3、填写好地址后,软件会自动检查是否是一个仓库,然后会出现一个登陆框,输入自己虚拟机的账户名密码后点击确定(勾选记住密码)。

4、可以设置ssh免密登陆,需要先在自己的本地(命令: ssh-keygen -t rsa )生成秘钥。

5、把把 id_rsa.pub 上传到虚拟机,并将 id_rsa.pub 内容追加(这儿的 >> 表示追加的意思,不然很可能就把文件里边原有的东西给覆盖掉了)到 authorized_keys 里边去:

6、将秘钥id_rsa导入到sourcetree中,并启动ssh助手。(具体过程可参考:https://jingyan.baidu.com/article/9faa7231cdec65473d28cb11.html)或自行查询。

四、客户端使用sourcetree进行word文档协同

当安装好git后,同步word文档,看不到对比,解决方法如下:

(因为word不是纯粹的二进制文件,所以需要先将其转换成二进制文件)

1、下载pandoc软件(去http://pandoc.org/installing.html 找到合适的pandoc下载文件,或者网上自行下载,网盘下载:链接:https://pan.baidu.com/s/1u8aCPTJVbxyO5AFt1hhIqQ 提取码:zk6b) ,然后安装。

2、 如果是在 unix(linux/macosx)系统下,编辑 ~/.gitconfig 文件,如果是在windows系统下,编辑 git 安装目录下的 /mingw64/etc/gitconfig 文件,加上这么一段话:

[diff "pandoc"]textconv=pandoc --to=markdownprompt = false
[alias]wdiff = diff --word-diff=color --unified=13、然后在你的工程目录下新建一个 .gitattributes(linux/mac)文件(windows是gitattributes 文件),然后写入:
*.docx diff=pandoc
*.doc   diff=pandoc
*.DOC   diff=pandoc
*.docx  diff=pandoc
*.DOCX  diff=pandoc

4、但是这个时候你提交的时候可以看到差别,但是历史记录中看不到差别,需要手动把文件转换为md文件,然后提交,也可以设置 git hooks 以启用自动生成和跟踪 .docx 文件的 Markdown 副本。在自己的仓库的文件路径中\.git\hooks中添加文件post-commit和pre-commit。

post-commit内容为:

#!/bin/bash# ========================================================================
# SUMMARY
# ========================================================================
#
# "pre-commit-git-diff-docx.sh": Small git (https://git-scm.com/)
# hook. It works in combination with another hook,
# "pre-commit-git-diff-docx.sh".
#
# Together, they keep a Markdown (.md) copy of .docx files so that git
# diffs of the .md files show the changes in the document (as .docx
# files are binaries, they produce no diffs that can be checked in
# emails or in the repository's commit page).
#
# ========================================================================
# DEPENDENCIES
# ========================================================================
#
# pre-commit-git-diff-docx.sh
# pandoc (http://pandoc.org/)
#
# ========================================================================
# INSTALLATION
# ========================================================================
#
# See pre-commit-git-diff-docx.sh
#
# ========================================================================
# DETAILS:
# ========================================================================
#
# This script checks whether file .commit-amend-markdown exists. If it
# exists, it amends the previous commit adding the names of .md files
# inside it.# Author: Ramon Casero <rcasero@gmail.com>
# Version: 0.1.0
# Copyright © 2016 University of Oxford
#
# University of Oxford means the Chancellor, Masters and Scholars of
# the University of Oxford, having an administrative office at
# Wellington Square, Oxford OX1 2JD, UK.
#
# This file is part of Gerardus.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details. The offer of this
# program under the terms of the License is subject to the License
# being interpreted in accordance with English Law and subject to any
# action against the University of Oxford being under the jurisdiction
# of the English Courts.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.# go to the top directory of this project, because filenames are
# referred to that location
cd `git rev-parse --show-toplevel`# check whether the commit included .docx files that were converted to
# markdown (.md) format
if [ -a .commit-amend-markdown ]
then# add Mardown versions (.md) of the .docx files to amend the# commitcat .commit-amend-markdown | xargs git add || {echo "Git cannot add Markdown files to amend the commit";exit 1;}# delete the file with the list of Markdown files to avoid an# infinite looprm .commit-amend-markdown# add the .md file by amending the last commit## --no-verify: prevent infinite loop, don't go into the pre-commit##              hook againecho Amend last commit adding .md filesgit commit --amend -C HEAD --no-verify || {echo "Git cannot amend the commit";exit 1;}fi
exit

pre-commit内容为:

#!/bin/bash# ========================================================================
# SUMMARY
# ========================================================================
#
# "pre-commit-git-diff-docx.sh:" Small git (https://git-scm.com/)
# hook. It works in combination with another hook,
# "post-commit-git-diff-docx.sh".
#
# Together, they keep a Markdown (.md) copy of .docx files so that git
# diffs of the .md files show the changes in the document (as .docx
# files are binaries, they produce no diffs that can be checked in
# emails or in the repository's commit page).
#
# ========================================================================
# DEPENDENCIES
# ========================================================================
#
# post-commit-git-diff-docx.sh
# pandoc (http://pandoc.org/)
#
# ========================================================================
# INSTALLATION
# ========================================================================
#
#   1) put both scripts in the hooks directory of each of your git
#      projects that use .docx files. There are several options,
#      e.g. you can put them in ~/Software and soft link to them from
#      the hooks directory, e.g.
#
#      cd $PROJECTPATH/.git/hooks
#      ln -s ~/Software/pre-commit-git-diff-docx.sh pre-commit
#      ln -s ~/Software/post-commit-git-diff-docx.sh post-commit
#
#      or you can make a copy in the hooks directory
#
#      cd $PROJECTPATH/.git/hooks
#      cp ~/Software/pre-commit-git-diff-docx.sh pre-commit
#      cp ~/Software/post-commit-git-diff-docx.sh post-commit
#
#   2) make sure that the scripts are executable
#
#      cd ~/Software
#      chmod u+x pre-commit-git-diff-docx.sh post-commit-git-diff-docx.sh
#
#
# ========================================================================
# DETAILS:
# ========================================================================
#
# This script makes a Markdown format copy (.md) of any .docx files in
# the commit. It then lists the .md file names in a temp file called
# .commit-amend-markdown.
#
# After the commit, the post-commit hook
# "post-commit-git-diff-docx.sh" will check for this file. If it
# exists, it will amend the commit adding the names of the .md files.
#
# The reason why we cannot simply add the .md files here is because
# `git add` adds files to the next commit, not the current one.
#
# This script requires pandoc (http://pandoc.org/) to have been
# installed in the system.# Author: Ramon Casero <rcasero@gmail.com>
# Version: 0.3.0
# Copyright © 2016-2017 University of Oxford
#
# University of Oxford means the Chancellor, Masters and Scholars of
# the University of Oxford, having an administrative office at
# Wellington Square, Oxford OX1 2JD, UK.
#
# This file is part of Gerardus.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details. The offer of this
# program under the terms of the License is subject to the License
# being interpreted in accordance with English Law and subject to any
# action against the University of Oxford being under the jurisdiction
# of the English Courts.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.# abort commit if pandoc is not installed
pandoc -v >/dev/null 2>&1 || { echo >&2 "I require pandoc to keep track of changes in .docx files but it's not installed. Aborting."; exit 1;
}# go to the top directory of this project, because filenames will be
# referred to that location
cd `git rev-parse --show-toplevel`# delete temp file with list of Mardown files to amend commit
rm -f .commit-amend-markdown# create a Markdown copy of every .docx file that is committed, excluding deleted files
for file in `git diff --cached --name-only --diff-filter=d | grep "\.docx$"`
do# name of Markdown filemdfile="${file%.docx}.md"echo Creating Markdown copy of "$file"#echo "$mdfile"# convert .docx file to Markdownpandoc "$file" -o "$mdfile" || {echo "Conversion to Markdown failed";exit 1;}# list the Markdown files that need to be added to the amended# commit in the post-commit hook. Note that we cannot `git add`# here, because that adds the files to the next commit, not to# this oneecho "$mdfile" >> .commit-amend-markdowndone# remove the Markdown copy of any file that is to be deleted from the repo
for file in `git diff --cached --name-only --diff-filter=D | grep "\.docx$"`
do# name of Markdown filemdfile="${file%.docx}.md"echo Removing Markdown copy of "$file"if [ -e "$mdfile" ]then# delete the Markdown filegit rm "$mdfile"# list the Markdown files that need to be added to the# amended commit in the post-commit hook. Note that we# cannot `git add` here, because that adds the files to the# next commit, not to this oneecho "$mdfile" >> .commit-amend-markdownfidone

手动设置如下:

  1. 从 linux 或 Windows 命令行运行 pandoc。这将创建您的文件的 Markdown 版本(没有数字,但有乳胶格式的方程)

     pandoc -s file.docx -t markdown -o file.md
    

  2. 更新变更日志

  3. 使用 git 提交两个文件

     git add file.docx file.mdgit commit

VMWare ESXi创建虚拟机并在虚拟机上搭建私有git相关推荐

  1. vmware ESXI 创建虚拟机报错verification failed (0x1a) security violation

    1.出现verification failed (0x1a) security violation报错 过段时间,页面出现报错Failed to load image :Security policy ...

  2. 在虚拟机上搭建云平台环境(1)Controller和Computer虚拟机的安装

    在虚拟机上搭建云平台环境(1)Controller和Computer虚拟机的安装 Controller和Computer虚拟机的安装 需要准备的软件有VM Ware.Centos7的iso镜像.Xia ...

  3. RHCSA学习 --- 在VMware上创建虚拟机并安装红帽linux系统

    RHCSA学习 - 在VMware上创建虚拟机并安装红帽linux系统 一.虚拟机创建 首先我们打开VMware,截至编辑时间最新版本已更新至16,可以自行去官网下载. 官网链接:https://ww ...

  4. 在虚拟机上搭建云平台环境(5)yum配置

    在虚拟机上搭建云平台环境(5)yum配置 本文涉及到代码复制,粘贴.CSDN中会复制多余信息导致出错,选择删除多余信息,或者去我的Blog添加配置 https://julur.github.io/ 一 ...

  5. 在虚拟机上搭建云平台环境(7)云平台组件服务安装

    在虚拟机上搭建云平台环境(7)云平台组件服务安装 本文涉及到代码复制,粘贴.CSDN中会复制多余信息导致出错,选择删除多余信息,或者去我的Blog添加配置 https://julur.github.i ...

  6. 在虚拟机上搭建云平台环境(2)Controller和Computer系统安装

    在虚拟机上搭建云平台环境(2)Controller和Computer系统安装 Controller和Computer系统的安装 安装Controller,开启Controller虚拟机 来到安装主界面 ...

  7. Ubuntu虚拟机上搭建PPPoE服务器并进行本地验证

    Ubuntu虚拟机上搭建PPPoE服务器并进行本地验证 本地环境 环境说明 实验拓扑 环境说明 环境搭建 对PPPoE服务器进行配置并验证 全局配置 关于PPPoE Server的配置 添加测试用的账 ...

  8. VMWare ESXI 给虚拟机硬盘扩容记录(CentOS7)

    虚拟机硬盘扩容记录 一.首次正常扩容 1. 进入虚拟机查看系统分区情况(检查容量是否增加) 2. 新建分区 3. 格式化新建的分区 4. 合并分区 5. 再次确认 问题:无法对 /dev/sda4 进 ...

  9. linux vmware 服务,学习笔记:在Linux虚拟机上搭建node服务

    最近在研究虚拟机,有一些服务因为编译环境或者系统原因,可能无法在自己的电脑上运行,使用虚拟机可以很好的解决这个问题.虚拟机是通过软件模拟的.具有完整硬件系统功能的.运行在一个完全隔离环境中的完整计算机 ...

最新文章

  1. 【漏洞复现】WordPress插件Quizlord 2.0 XSS漏洞复现与分析
  2. 三维渲染引擎设计与实践(四)
  3. 简单的java单位换算_单位换算示例代码
  4. Redis--COW(Copy On Write)
  5. Change FZU - 2277(线段树+dfs序)
  6. php mysql unsigned,PHP MySQL 核心
  7. 有效利用时间12妙招
  8. php运行出现Call to undefined function curl_init()解决方法
  9. 内核编程之Hello_kernel
  10. activexobject mysql_ActiveXObject函数详解(转)
  11. 2011年计算机一级考试题,2011年计算机一级考试模拟试题及参考答案(1)
  12. C#使用System.Data.SQLite操作SQLite
  13. hive order by sort by distribute by总结
  14. 第一个android应用程序,深入学习Android 第一个应用程序
  15. HTML:使用JavaScript(js)脚本在网页上显示实时时间
  16. CSS像素(px)、物理像素(pt)、rem、em、rpx
  17. Web应用网站CDN加速访问技术原理
  18. OGG FOR BIGDATA 安装(修正)
  19. python 跳过_如果文件已经存在,Python将跳过一个函数
  20. 如何将PDF格式转换为WORD文档

热门文章

  1. System_Verilog打印格式
  2. 【深度学习】梯度下降和反向传播
  3. GateOne CVE-2020-35736 任意文件读取漏洞复现
  4. 合肥学院期末考试卷java_JavaWeb期末考试A卷
  5. uniapp 设置 style 动态背景
  6. char a[](字符串数组)和char *a(字符串指针)区别
  7. 对RCS数据进行预处理
  8. 大一计算机实操知识试题及答案,大学计算机一级考试操作题及答案
  9. 微信扫码自动跳转技术
  10. linux tar.gz zip 解压缩命令