git - 如何在服务器上运行不同版本的 git?
问题描述
我在具有旧版本 git (1.7.1) 的服务器上有一个 git 存储库。我需要一个仅从 git 2.3 开始可用的功能,即我想运行以下命令:
git config receive.denyCurrentBranch updateInstead
在与系统管理员交谈后,他们在服务器上的不同位置安装了最新版本的 git (2.27.0)。使用这个较新的版本,我能够为存储库运行上述命令。
但是,每当我从本地计算机推送到服务器时,都会收到以下错误消息:
fatal: bad config value for 'receive.denycurrentbranch' in ./config
fatal: Could not read from remote repository.
这似乎在暗示,当我push
到服务器时,服务器默认运行旧版本的 git。有没有办法告诉服务器从不同的执行路径运行 git?跑步时
git --exec-path=/path/to/new/git/env
我遇到了奇怪的错误,比如 git 忽略 之后的所有内容exec-path
,或者完全忽略所有标志。我不确定这个--exec-path
标志是否是解决这个问题的正确方法。
解决方案
您需要指定新的git-upload-pack
/git-receive-pack
cd /path/to/local/repo
git config remote.origin.uploadpack /path/to/new/git/usr/bin/git-upload-pack
git config remote.origin.receivepack /path/to/new/git/usr/bin2/git-receive-pack
这将是确保 git push/pull 与正确的 Git 对话的良好开端。
推荐阅读
- html - Line Icon whatsapp icon CSS样式
- javascript - 仅在用户“获胜”时显示内容
- node.js - 匹配任何字符(包括空格),直到最后一串空格
- c++ - 如何推断 lambda 的返回类型?
- javascript - 遍历 HTML 输入并设置值
- vue.js - 如何在 vue tel 输入中获取国家/地区代码?
- android - IDA 调试 Android 内核 - 查找 check_flags() 地址
- python - 如何用 concurrent.futures 替换嵌套循环?
- asp.net - 等待来自 Web 服务的响应时,ASP.NET 中的“线程被中止”
- css - 当页面从桌面加载到移动响应式布局时更改列的顺序