ue----git局域网内部署裸仓库,别的机器进行访问

最近由于经常迁移项目到另一台机器上进行部署更新一点就要整个迁移 弄得麻烦了

就在网上学了一下这个方式

首先我们在想要建立裸仓库的电脑上找到一个文件夹放置我们的裸仓库

在此点击鼠标右键选择 open git bash here

输入命令 创裸仓库

复制代码
git init --bare gitTestName.git

这样裸仓库就已经构建了

现在来到一个我们存放项目的地方 也就是本地的仓库的位置

在此鼠标右键 打开git命令行

输入 创建本地仓库(没有的话)

复制代码
git init

添加远程仓库(也就是刚刚的裸仓库)这是目前我本机上的本地路径

复制代码
git remote add originName /Y/YSP/UE_project/gitTest/gitTestName.git

originName 是你想对远端仓库取的名字

输入 检查一下

复制代码
git remote -v

这样的远端仓库就添加成功了

在本地仓库随便创建一个文件

添加到暂存

复制代码
git add .

提交到本地仓库

复制代码
git commit -m"t"

推送到远程仓库

复制代码
git push originName master

master 是分支名称 这个远程仓库没有分支 会进行创建 有则不会

我们来到远程仓库 看到已经有提交了

现在我们要去另一台电脑上了

对了我这个是Windows系统的 首先要保证 我们的裸仓库文件夹是可以被网络发现的

另一台电脑上 先创建一个文件夹

打开网络映射器

选择我们在网络发现里的裸仓库文件夹 点击确定(上一级)

输入

复制代码
git clone /X/gitTestName.git

path 是 刚刚映射出来的裸仓库文件夹 等待片刻即可

如果报错

复制代码
Cloning into 'gitTestName'...
fatal: detected dubious ownership in repository at 'X:/gitTestName.git'
'X:/gitTestName.git' is owned by:
        (inconvertible) (S-1-5-21-1197519011-1549774375-2643100596-1001)
but the current user is:
        DESKTOP-DQ6V1QT/dell (S-1-5-21-1450924175-3348304483-3808369906-1001)
To add an exception for this directory, call:

        git config --global --add safe.directory X:/gitTestName.git
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

添加这句

复制代码
git config --global --add safe.directory X:/gitTestName.git

再去

复制代码
git clone /X/gitTestName.git

这样就成功了

随便写点东西

先提交到本地仓库 再 上传到远程仓库

现在我们来到第一台电脑进行查看 裸仓库(远程仓库)

看到已经有提交了

我们现在 拉取下来看看

复制代码
git pull originName master

好了 这边成功可以拉取到

局域网测试成功 当然还有其他的方式 目前我不会

相关推荐
IsITGirl7 分钟前
VMware Fusion(Mac)Windows ARM 虚拟机 NAT (vmnet8) 报错解决记录
windows·macos·.net·桥接模式
Rudon滨海渔村29 分钟前
台式机Win10实现“音量+”和“音量-”,键盘映射方案
windows·计算机外设·powertoys
2501_9159214330 分钟前
KXBuild CI 实操,Windows/Linux 服务器接入 Jenkins 打包 iOS IPA
服务器·windows·vscode·ios·ci/cd·个人开发·敏捷流程
谙弆悕博士1 小时前
debian快速换源
linux·运维·windows·debian·下载·换源·网络问题
?re?ta?rd?ed?17 小时前
C++11新特性,{}与左值
c++·windows
不老刘19 小时前
Antigravity 的 New Worktree 模式:给 AI 代理一个安全的“平行工位”
人工智能·git·ai编程·antigravity
光谱SpectrAI19 小时前
Windows 也中招:Git Bash 和 Node 仍信任泄露的 eMudhra 证书
git
YIN_尹19 小时前
【git原理与使用】git初识与安装
大数据·git·elasticsearch
必须得开心呀20 小时前
windows10系统任务栏图标消失修复
windows
zl_dfq20 小时前
Windows 下 UDP 套接字编程指南
网络·windows·udp