背景:几年前我重新安装了 Linux Mint,现在又安装了几个月的 Linux Mint 22 Cinnamon,所以我不知道我的问题是否与 VS Codium 有关,它是 VS Code 的免费/自由开源软件二进制文件,这意味着它已禁用遥测,我假设还有其他一些与遥测/跟踪相关的内容。我决定从MS VS Code切换到免费/自由 VS Codium,同时安装新的操作系统。
问题是我不记得了,我该如何设置(如果有的话)git
来强制它用我的 GPG 密钥签署我的所有提交?
背景:几年前我重新安装了 Linux Mint,现在又安装了几个月的 Linux Mint 22 Cinnamon,所以我不知道我的问题是否与 VS Codium 有关,它是 VS Code 的免费/自由开源软件二进制文件,这意味着它已禁用遥测,我假设还有其他一些与遥测/跟踪相关的内容。我决定从MS VS Code切换到免费/自由 VS Codium,同时安装新的操作系统。
问题是我不记得了,我该如何设置(如果有的话)git
来强制它用我的 GPG 密钥签署我的所有提交?
我尝试curl
在 Windows git bash 终端下使用(v8.6.0)向服务器端发送 HTTP 请求,服务器端是一个 Java spring boot 应用程序,当curl
JSON 内容包含中文时,服务器端会显示此错误:
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
我发现这需要一个--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 提交一起使用的格式化程序。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 diff
为一个调用替代 diff 来查看文件差异的命令,/usr/bin/vim -dR "$2" "$3"
即当我想使用git diff > patchfile
.
有没有办法直接调用 git 自己的内置 diff,而不禁用我用于视觉比较的替代 diff?
我正在使用 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/hiredis
so 中的元层中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'
}
0.14.0
hiredis版本如果我执行命令:
> 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
因为变量的值为(该值由配方名称设置)。PV
0.14.0
PV
为什么获取的hiredis库版本是0.14.0
最新的而不是最新的?
git fetch --all --no-tags
并没有按照它所说的去做,并且每次运行它时都会重新获取标签。如何在不获取标签的情况下实际从所有遥控器获取数据?
重现:
[email protected]:cachix/install-nix-action.git
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]
这个问题有很多设置:
我有一个主机 ( rpi5.local
),有 2 个用户帐户:pi
和cake
。
我想探索git
,并且创建了cake
帐户来“拥有”“服务器/起源”存储库。作为用户cake
,/home/cake
我创建了一个文件夹 ( git-srv
),其中有一个名为 的子文件夹projectA
。我经历了使用初始化此存储库的过程git init --bare
。
最初,我projectA
从另一台主机( )“填充”了服务器上的存储库rpi4b.local
。我使用以下序列通过 SSH将主机上push
调用的文件夹中的一些文件编辑到存储库:Aproject
raspberrypi4b.local
projectA
$ hostname
rpi4b.local
$ pwd
/home/pi/Aproject
$ git push -u ssh://[email protected]/home/cake/git-srv/projectA.git
这很好用。
作为用户pi
,我clone
将projectA
存储库保存到/home/pi/XYZ
. 我对commit
中的一个文件进行了一些更改/home/pi/XYZ
,并尝试push
对服务器进行这些更改,如下所示:
$ hostname
rpi5.local
$ pwd
/home/pi/XYZ
$ git push -u /home/cake/git-srv/projectA.git
我从这次努力中得到了一个错误:
...
error: remote unpack failed: unable to create temporary object directory
To /home/cake/git-srv/projectA.git
! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to '/home/cake/projectA.git'
经过对这个错误的一些研究后,我得出结论,这是和之间的权限问题。我认为解决方案是作为用户,所以我这样做了,然后再次尝试。最后,我的问题是:pi
cake
su cake
pi
push
$ whoami
cake
$ hostname
rpi5.local
$ pwd
/home/pi/XYZ
$ git push -u /home/cake/git-srv/projectA.git
fatal: failed to stat '/home/pi/motd.git': Permission denied
在这种情况下意味着什么failed to stat
?是否有简单的解决方法?
标题中有问题,但让我详细说明一下。排除 git CLI 上的 ID/密码方法,我们生成 SSH 密钥并将公钥添加到远程服务器。为什么我们没有无 SSH 的公钥加密方法?我们甚至没有连接到远程机器的终端,我们甚至不需要连接远程机器的终端(是吗?),那么为什么它被命名为 SSH 密钥呢?仅仅是命名约定还是其他什么?这背后的历史是什么?
我的.gitignore
文件指示忽略该../../.aws/
目录:
$ cat .gitignore
coredumps/
../../.aws/
.*.sw*
*bak
*log
唉,这条指令被忽略了:
$ git status | head -6
# On branch main
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# ../../.aws/
# ../../.bash_history
我应该如何更改 my.gitignore
以便将 the ../../.aws/
will 从输出中排除git status
?