AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题

问题[git](unix)

Martin Hope
siery
Asked: 2025-02-22 02:10:51 +0800 CST

使用远程源在生产服务器上配置 git 存储库

  • 6

这可能是一个模糊的问题,但我目前无法找到一个好的解决方案。

我在公司服务器上运行一个 BookStack 应用程序。为了简化和保证安全,我有一个自定义.gitignore文件,它忽略了除我们的自定义扩展和.env配置之外的所有内容。

这个想法是,开发人员可以将生产存储库作为远程源添加到带有 BookStack 的目录中,并与模拟数据库一起进行安全地测试。

现在,只要我不必从 BookStack 存储库获取数据,这就可以了。如果我现在将 BookStack 添加为生产服务器上的远程源,它将与.gitignore更新冲突。

除了每次更新时解决这个冲突之外,您对如何解决这个问题还有什么建议吗?

git
  • 1 个回答
  • 61 Views
Martin Hope
Milenko Markovic
Asked: 2025-01-30 22:44:17 +0800 CST

为什么 git diff 不起作用?致命:错误修订 '[6.1...]'

  • 5

我想比较 6.1(主要版本)和我的分支

git diff [6.1...] -- [/MM-pizdmr-are-up-to-date]
fatal: bad revision '[6.1...]'

我尝试了 Github UI,但是它花费了太多时间并且建议

git diff 6.1.../MM-pizdmr-are-up-to-date
fatal: ambiguous argument '6.1.../MM-pizdmr-are-up-to-date': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

我的 diff 出了什么问题?

git
  • 1 个回答
  • 28 Views
Martin Hope
Milenko Markovic
Asked: 2025-01-24 22:01:33 +0800 CST

如何在CI步骤上检查git瓷化?

  • 5

我把这个步骤添加到CI

  check_if_there_is_change:
      - run: 
          name: Check that no git-tracked files were modified
          command: |
          FILES_MODIFIED="$(git status --porcelain)"
        if [[ -n "$FILES_MODIFIED" ]]; then
          echo "The following files were modified or added during the build process:"
          echo "$FILES_MODIFIED"
          echo "This will likely prevent successful publishing. Please run the build locally and include these changes in your pull request)"
          exit 1
        fi

但它失败了

yaml.scanner.ScannerError: while scanning a simple key
  in ".circleci/main.yml", line 638, column 11
could not find expected ':'
  in ".circleci/main.yml", line 639, column 9

IntelliJ 在块映射中显示无效的子元素。

如何更改?我想知道文件是否已被修改。

git
  • 1 个回答
  • 14 Views
Martin Hope
Vlastimil Burián
Asked: 2024-11-18 19:18:46 +0800 CST

如何启用 git gpg 对我电脑上的所有提交进行签名

  • 5

背景:几年前我重新安装了 Linux Mint,现在又安装了几个月的 Linux Mint 22 Cinnamon,所以我不知道我的问题是否与 VS Codium 有关,它是 VS Code 的免费/自由开源软件二进制文件,这意味着它已禁用遥测,我假设还有其他一些与遥测/跟踪相关的内容。我决定从MS VS Code切换到免费/自由 VS Codium,同时安装新的操作系统。


问题是我不记得了,我该如何设置(如果有的话)git来强制它用我的 GPG 密钥签署我的所有提交?

git
  • 1 个回答
  • 29 Views
Martin Hope
Dolphin
Asked: 2024-10-18 12:15:05 +0800 CST

能否让 Windows git bash 支持中文

  • 5

我尝试curl在 Windows git bash 终端下使用(v8.6.0)向服务器端发送 HTTP 请求,服务器端是一个 Java spring boot 应用程序,当curlJSON 内容包含中文时,服务器端会显示此错误:

Caused by: com.fasterxml.jackson.databind.JsonMappingException: Invalid UTF-8 start byte 0xb2
  at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 1, column: 11] (through reference chain: com.guangdanet.youxue.admin.rest.vo.product.line.LineSaveReqVO["name"])
    at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:402)
    at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:361)
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.wrapAndThrow(BeanDeserializerBase.java:1863)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:394)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:185)
    at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
    at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:2105)
    at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1481)
    at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:395)
    ... 175 common frames omitted

Caused by: com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 start byte 0xb2
  at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 1, column: 11]
    at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2477)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:750)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidInitial(UTF8StreamJsonParser.java:3712)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidChar(UTF8StreamJsonParser.java:3708)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishString2(UTF8StreamJsonParser.java:2634)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishAndReturnString(UTF8StreamJsonParser.java:2560)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.getText(UTF8StreamJsonParser.java:335)
    at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:42)
    at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:11)
    at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:392)

jackson 是 spring boot 应用程序的默认 JSON 解析器,该服务器端可以很好地处理 Google Chrome xhr 请求,但处理curl来自 Windows git 终端的请求时失败。

我是不是漏掉了什么?看起来这个 git bash 在 Windows 中存在一些编码问题。我应该怎么做才能让 Windows git bash 支持中文?

这是curl信息:

curl 8.6.0(x86_64-w64-mingw32) 1ibcur1/8.6.0 schannel z1ib/1.3.1 brotli/1.1.0std/1.5.5 1ibidn2/2.3.7 1ibps1/0.21.5 1ibssh2/1.11.0
    Release-Date: 2024-01-31
    Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns lda2 ldaps mgtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
    Features: alt-svc AsynchDNs brotli HSTS HTTPS-prOXy IDN IPv6 Kerberos Largefileibz NTLM PSL SPNEGO SSL SSPI threadsafe UnixSockets zstd
git
  • 1 个回答
  • 52 Views
Martin Hope
Franklin
Asked: 2024-03-25 19:03:33 +0800 CST

如何更改“git分支-vv”的输出颜色

  • 5

我发现这需要一个--format论点:

       --format <format>
           A string that interpolates %(fieldname) from a branch ref being shown and the object it points at. The format is the same as that of git-for-each-ref(1).

当我看的时候man git-for-each-ref我发现

 When unspecified, <format> defaults to %(objectname) SPC %(objecttype) TAB %(refname).

底部有以下示例:

           --format='From: %(*authorname) %(*authoremail)
           Subject: %(*subject)
           Date: %(*authordate)
           Ref: %(*refname)

           %(*body)
           ' 'refs/tags'

--format="ref=%(refname)"

还有一些我了解得更少的东西。

我想要的只是改变这里的蓝色阴影。请帮助! 在此输入图像描述

git
  • 1 个回答
  • 26 Views
Martin Hope
m000
Asked: 2024-02-29 23:07:11 +0800 CST

支持项目符号的文本格式化程序

  • 7

我正在寻找一个与我的 git 提交一起使用的格式化程序。par几乎做了我想要的,但(重要的)限制是我无法让它正确格式化项目符号列表,这在提交消息中很常见。

例如:

% export PARINIT="rTbgqR B=.,?'_A_a_@ Q=_s>|"
% par << EOF                                                                                                                                            
heredoc> [JR-1234] This is a fix for the thing.

I am a developer that doesn't like linebreaks. I am a developer that doesn't like linebreaks. I am a developer that doesn't like linebreaks.

  - I am a developer that doesn't like linebreaks. I also like bullet lists. I like bullet lists a lot.
  - I like bullet lists. I like bullet lists a lot. I am also a developer that doesn't like linebreaks.

I am a developer that doesn't like linebreaks. I am a developer that doesn't like linebreaks. I am a developer that doesn't like linebreaks.
heredoc> EOF

这给出了输出:

[JR-1234] This is a fix for the thing.

I am a developer that doesn't like linebreaks. I am a developer that
doesn't like linebreaks. I am a developer that doesn't like linebreaks.

  - I am a developer that doesn't like linebreaks. I also like bullet
  - lists. I like bullet lists a lot.  I like bullet lists. I like
  - bullet lists a lot. I am also a developer that doesn't like
  - linebreaks.

I am a developer that doesn't like linebreaks. I am a developer that
doesn't like linebreaks. I am a developer that doesn't like linebreaks.

同时,我想要这样的东西:

[JR-1234] This is a fix for the thing.

I am a developer that doesn't like linebreaks. I am a developer that
doesn't like linebreaks. I am a developer that doesn't like linebreaks.

  - I am a developer that doesn't like linebreaks. I also like bullet
    lists. I like bullet lists a lot.
  - I like bullet lists. I like bullet lists a lot. I am also a
    developer that doesn't like linebreaks.

I am a developer that doesn't like linebreaks. I am a developer that
doesn't like linebreaks. I am a developer that doesn't like linebreaks.

这样做par是理想的,但其他一些同样的独立格式化程序也可以。

git
  • 1 个回答
  • 39 Views
Martin Hope
vfclists
Asked: 2024-02-27 09:26:07 +0800 CST

在配置不同的视觉“git diff”替代品后,如何直接调用 git 的内置 diff 命令?

  • 5

我已配置git diff为一个调用替代 diff 来查看文件差异的命令,/usr/bin/vim -dR "$2" "$3"即当我想使用git diff > patchfile.

有没有办法直接调用 git 自己的内置 diff,而不禁用我用于视觉比较的替代 diff?

git
  • 1 个回答
  • 36 Views
Martin Hope
User051209
Asked: 2024-01-11 17:30:07 +0800 CST

在 yocto 配方中,什么选择要从 GitHub 存储库下载的版本?

  • 5

我正在使用 yocto 构建我的自定义 Linux 发行版。我需要添加hiredis到我的发行版中。hiredis是一个用于 Redis 数据库的简约 C 客户端库,我需要它来通过 C 应用程序访问 Redis。

食谱hiredis_0.14.0.bb

在我的 yocto 构建系统中,配方存储hiredis_0.14.0.bb在文件夹meta-openembedded/meta-oe/recipes-extended/hiredisso 中的元层中meta-openembedded。

菜谱内容如下:

DESCRIPTION = "Minimalistic C client library for Redis"
HOMEPAGE = "http://github.com/redis/hiredis"
LICENSE = "BSD-3-Clause"
SECTION = "libs"
DEPENDS = "redis"

LIC_FILES_CHKSUM = "file://COPYING;md5=d84d659a35c666d23233e54503aaea51"
SRCREV = "685030652cd98c5414ce554ff5b356dfe8437870"
SRC_URI = "git://github.com/redis/hiredis;protocol=git \
           file://0001-Makefile-remove-hardcoding-of-CC.patch"

S = "${WORKDIR}/git"

inherit autotools-brokensep pkgconfig

EXTRA_OEMAKE = "PREFIX=${prefix} LIBRARY_PATH=${baselib}"

# By default INSTALL variable in Makefile is equal to 'cp -a', which preserves
# ownership and causes host-user-contamination QA issue.
# And PREFIX defaults to /usr/local.
do_install_prepend() {
  export INSTALL='cp -r'
}

Git Fetcher 下载0.14.0hiredis版本

如果我执行命令:

> bitbake hiredis

代码由GitHubhiredis获取并正确编译。从GitHub下载的代码上的版本是0.14.0,而设置为:SRC_URI

SRC_URI = "git://github.com/redis/hiredis;protocol=git \
           file://0001-Makefile-remove-hardcoding-of-CC.patch"

该值表示SRC_URI正在使用Git Fetcher并且未指定参数branch,或者rev表示该参数的值为master。

对版本的唯一引用0.14.0是在配方名称 (hiredis_ 0.14.0.bb) 中,因此选择版本是0.14.0因为变量的值为(该值由配方名称设置)。PV0.14.0PV

我的问题

为什么获取的hiredis库版本是0.14.0最新的而不是最新的?

git
  • 1 个回答
  • 62 Views
Martin Hope
l0b0
Asked: 2023-12-18 11:42:04 +0800 CST

如何从没有标签的 Git 远程获取数据?

  • 5

git fetch --all --no-tags并没有按照它所说的去做,并且每次运行它时都会重新获取标签。如何在不获取标签的情况下实际从所有遥控器获取数据?

重现:

  1. 分叉这个仓库
  2. 克隆你的叉子
  3. 添加上游遥控器[email protected]:cachix/install-nix-action.git
  4. git fetch --all --no-tags

应该发生什么:这笔交易不应该伤害任何标签。

实际发生的情况:遥控器破坏了彼此的标签:

❯ git fetch --all --no-tags
Fetching origin
From github.com:example-user/install-nix-action
 - [deleted]                   (none)     -> [omitted]
[…]
Fetching upstream
From github.com:cachix/install-nix-action
 * [new tag]                   [omitted]  -> [omitted]
[…]

当仅获取默认远程时,它甚至会表现出这种行为:

❯ git fetch --no-tags
From github.com:example-user/install-nix-action
 - [deleted]                   (none)     -> [omitted]
git
  • 1 个回答
  • 36 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve