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
    • 最新
    • 标签
主页 / computer / 问题

问题[git](computer)

Martin Hope
yaris
Asked: 2025-03-10 11:11:10 +0800 CST

解读 Git 拉取消息

  • 9
minnymouse@XXXXXXX  /c/XXXXXXXXX/XXXXXXXXX/XXXXXXXXX (development)
$ git status
On branch development
Your branch is ahead of 'origin/development' by 2 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

minnymouse@XXXXXXX /c/XXXXXXXXX/XXXXXXXXX/XXXXXXXXX (development)
$ git push origin development
To ssh://xxxxxx/xxx/xxxxx/git/repos/xxxxx
 ! [rejected]        development -> development (fetch first)
error: failed to push some refs to 'ssh://xxxxxx/xxx/xxxxx/git/repos/xxxxx'
hint: Updates were rejected because the remote contains work that you do not
hint: have locally. This is usually caused by another repository pushing to
hint: the same ref. If you want to integrate the remote changes, use
hint: 'git pull' before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

minnymouse@XXXXXXX /c/XXXXXXXXX/XXXXXXXXX/XXXXXXXXX (development)
$ git pull
remote: Counting objects: 10, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 10 (delta 5), reused 0 (delta 0)
Unpacking objects: 100% (10/10), 1.06 KiB | 43.00 KiB/s, done.
From ssh://xxxxxx/xxx/xxxxx/git/repos/xxxxx
   7948726..7dc3f5c  development     -> origin/development
   b9042ed..d04db55  feature/luxor   -> origin/feature/luxor
   7948726..7dc3f5c  production      -> origin/production
hint: Waiting for your editor to close the file...

如果我关闭编辑器而没有评论,是否会完全中止拉取?如果不是,编辑器文件中的消息是什么意思:

# Lines starting with '#' will be ignored, and an empty message aborts the commit.

所有这些都会集成到我的本地开发副本中吗?如果不是,这样做的目的是什么?

7948726..7dc3f5c  development     -> origin/development
b9042ed..d04db55  feature/luxor   -> origin/feature/luxor
7948726..7dc3f5c  production      -> origin/production
git
  • 1 个回答
  • 24640 Views
Martin Hope
Sam Newall
Asked: 2024-12-11 15:07:23 +0800 CST

将本地 git repo 从 macOS 移动到外部硬盘驱动器(APFS 不区分大小写) - 会出现问题吗?

  • 8
该问题已从 Stack Overflow迁移过来,因为可以在 Super User 上找到答案。 昨天已迁移 。

我的 M1 Mac Mini(运行 Sonoma 14.6.1)上有一个本地 git repo,我想将其移动到外部硬盘上(以释放 Mac 上的空间)。

外部硬盘驱动器是新的(空的)并且已格式化为 APFS(不区分大小写),因为我读到这是与 Mac 的最佳兼容性(macOS 本身不区分大小写)。

我想将我的本地 git repo(完整路径为/Users/a/b/c/d)移动到外部硬盘(完整路径为/Volumes/hDrive)。

到目前为止,我最好的猜测是执行以下操作:

mv /Users/a/b/c/d/* mv /Users/a/b/c/d/.* /Volumes/hDrive/

这会将所有文件、目录、隐藏文件和隐藏目录(包括 .git)移动到我的硬盘上。(此建议来自https://www.baeldung.com/linux/move-files-hidden-parent)

但是,我读到过,Git 通常区分大小写(因为 Linux 也是如此),因此在移动到不区分大小写的硬盘时,这可能会引发问题。但是,这个目录只在我的 Mac 上使用过,它不区分大小写,我从未遇到过问题。

  1. 我上面提供的命令行代码能完成我想要的操作吗?

  2. 将本地 git repo 从我的 Mac 移动到不区分大小写的硬盘时会遇到什么问题吗?

git
  • 2 个回答
  • 30 Views
Martin Hope
sloppy
Asked: 2024-12-09 02:28:40 +0800 CST

如果项目根目录中没有 .git 文件夹,VSCode 将使用特定的 .git 文件夹

  • 7

我正在使用基于 Git 的点文件管理:

  1. https://www.stefanjudis.com/notes/git-based-dotfile-management-without-symlinks/
  2. https://www.atlassian.com/git/tutorials/dotfiles

我有裸 git 存储~/Repositories/dotfiles库alias dotfiles='git --git-dir=$HOME/Repositories/dotfiles --work-tree=$HOME'

和dotfiles config --local status.showUntrackedFiles no

当我使用 VSCode 编辑我的点文件时,它git不起作用,因为.git其中没有文件夹,~/.config/zsh例如它位于~/Repositories/dotfiles哪个轨道中~/。

如果项目根目录中没有文件夹,我可以从裸存储库git使用 VSCode 扩展吗?基本上是一个后备方案。.git~/Repositories/dotfiles.git.git

git
  • 1 个回答
  • 118 Views
Martin Hope
Zsar
Asked: 2024-11-23 03:30:19 +0800 CST

如何将基于线的管道转变为连续流?

  • 5

在不断寻求将 .po 文件合理地纳入 git 版本控制的过程中,我编写了这个脚本用于 diff 和 filter-clean: msgcat --no-location --no-wrap --sort-output - | msgattrib --no-obsolete - | grep -Ev '^"POT-Creation-Date|^"PO-Revision-Date|^"Last-Translator|^"X-Generator'

调用此脚本的 .gitconfig 条目如下所示:

[diff "podiff"]
    textconv = cat "$1" | "$(git rev-parse --show-toplevel)"/podiff
    cachetextconv = true
[filter "pocomments"]
    clean = "$(git rev-parse --show-toplevel)"/podiff
    smudge = cat "$1" # NOP; enable the other one temporarily to affect files on checkout, restore, etc., but please do not commit it -Zsar 2024-06-10
#   smudge = "$(git rev-parse --show-toplevel)"/podiff
    required

每个步骤都完成一项关键功能:

  1. 重构和不相关的代码更改使源位置和输入顺序不断变化。此 msgcat 调用将这些标准化,因此 commit-tet 文件没有这些更改。
  2. 每当 msgid 发生更改时,过时的条目会使更改集的大小加倍。我们有版本控制 -> 此 msgattrib 调用会删除它们。
  3. 每次有人使用专用工具编辑.po 文件的元数据条目中的这些字段时,它都会发生变化- 我们有版本控制 -> 这个 grep 调用会将它们删除。

现在又出现了一个障碍。注意到--no-wrap前面了吗?它不起作用。
此外,换行不稳定:每次奇怪的提交,都会有人在没有人为更改的情况下在行之间翻转一个单词。
此外,相关工具 Poedit也有一个“换行于”设置,禁用它也不起作用。(因为它委托给 gettext 工具,这并不奇怪。但这意味着我无法“仅此一次”规范化文件并完成它。- 因此我首先使用 git 过滤器。)

很好,我想到了,并测试了这个调用来删除它们:sed -z -e 's/\"\n\"//'。
它是将“msgid”和“msgstr”中的任何换行连接起来,这样工具就可以随心所欲地换行,每天都换一种方式,我不在乎。

  • 它可以独立工作:sed -z -e 's/\"\n\"//' test.po打印预期的输出。
  • 当通过 cat 管道传输时,它可以工作:cat test.po | sed -z -e 's/\"\n\"//'打印预期的输出。
  • 但是,当添加到现有脚本时,sed 步骤不起作用。

它似乎逐行接收输入。我尝试将它放在 grep 前面,但没有任何改善,而且我无法将它移到其他两个前面,因为 msgcat 和 msgattrib 有“我喜欢随机包装”的问题,这才是引发整个问题的根本原因。

我可以流式传输grep 的输出,或者更一般地基于行的管道的输出,以便我的流编辑器可以执行其工作吗?

(注:这个网站上有很多答案说“sed 不能做到这一点” - 但 sed 专门设计为不关心换行符,所以这听起来像是错误的信息。摘自手册页:

Sed 是一个流编辑器。流编辑器用于对输入流(文件或来自管道的输入)执行基本的文本转换。[...] sed 的工作原理是只对输入进行一次传递[.]

强调我的

问题很明显,有多个输入,我想要替换的字符串在它们之间分割。)

git
  • 1 个回答
  • 34 Views
Martin Hope
Christopher
Asked: 2024-09-12 08:30:05 +0800 CST

为新手创建和配置 SSL 证书

  • 5

我是配置 OpenSSL 的完全新手;我已经通过 Windows 上的 git 在我的 Windows 计算机上找到了 OpenSSL 可执行文件。

虽然我不知道从哪里开始为将要访问并需要登录名和密码的站点创建 SSL 证书,但只要客户端拥有该站点的 SSL 证书,SSL 就会为客户端发挥作用,向客户端发送登录名和密码。否则,如果客户端没有证书,站点将显示用户输入其登录名和密码。

我搜索了如何设置和配置 OpenSSL,但大多数网站只告诉如何安装它,而我不需要这些信息。我已准备好运行执行此问题中要求的操作所需的命令。

git
  • 1 个回答
  • 30 Views
Martin Hope
Chris Pfohl
Asked: 2024-05-07 00:21:37 +0800 CST

是什么导致 Git 引用损坏?

  • 6

刚刚帮助一位朋友调试了“损坏的 git 引用”。修复很容易update-ref -d或rm -r .git/refs/...,但我仍然不明白是什么导致了这个问题。

我对 git 的底层有中等程度的了解,但我还没有深入研究实际.git目录。

分支/引用如何存储.git?这会导致引用损坏吗?发生这件事时,他并没有做什么异常的事情。

git
  • 1 个回答
  • 23 Views
Martin Hope
Vectornaut
Asked: 2024-01-27 01:56:15 +0800 CST

以“使用 GitHub 登录”用户身份推送到 Gitea 存储库

  • 7

我已使用“使用 GitHub 登录”功能在 Gitea 实例上设置了一个帐户,并且该帐户已被授予对 Gitea 存储库的写入权限。当我尝试将本地更改推送到 Gitea(使用我共享的 GitHub 和 Gitea 用户名)时,系统会提示我输入密码。提供我的 GitHub 访问令牌或密码会导致“身份验证失败”消息。

  • 作为“使用 GitHub 登录”用户,我可以从本地存储库推送到 Gitea 吗?如果是这样,怎么办?

我计划尝试的下一件事是使用用户设置›帐户控制面板为 Gitea 帐户设置密码。我不确定是否可以执行此操作,因为它要求我输入当前的 Gitea 密码,而我没有该密码,而且我担心尝试执行此操作可能会破坏我现有的 GitHub 登录能力。

  • 作为“使用 GitHub 登录”的用户,我可以设置 Gitea 密码吗?如果是这样,怎么办?

我找不到“使用 GitHub 登录”功能的任何文档。搜索有关外部用户的文档并使用 OAuth 进行推送也一无所获。

  • “使用 GitHub 登录”功能的文档在哪里?
git
  • 2 个回答
  • 155 Views
Martin Hope
jeremywat
Asked: 2023-12-15 07:46:41 +0800 CST

如何使 git reset (或其他方法)删除空目录?

  • 6

我有一个 git 存储库,我需要克隆它,做一些事情,然后打包并发送给其他人。我通过 Ansible 使这一切自动化,因此不需要用户干预。

我想确保在克隆存储库之后,在“打包”之前,它会重置为所需的状态(分支/标签),从而删除之后可能已添加到本地文件夹/工作树的任何文件/文件夹它被克隆了。为此,我正在使用git reset --hard $ref.

这可以很好地删除不需要的文件,但问题是如果将空文件夹添加到存储库目录中,则不会将其删除。

git 有没有办法删除空文件夹和文件?

git
  • 1 个回答
  • 27 Views
Martin Hope
xanld
Asked: 2023-10-30 04:38:55 +0800 CST

找不到 GPG 密钥

  • 5

请帮我调试这组终端命令。

我已经创建了一个 GPG 密钥并将其添加到 github,并且正在尝试签署我的提交:

me@my-macbook myproject % gpg --list-secret-keys --keyid-format=long
[keyboxd]
---------
sec   rsa4096/CMC8D2G96B994245 2023-10-27 [SC] [expires: 2025-10-26]
      07A38FD8F66EBD7597K3ID51CMC8D2G96B994839
uid                 [ultimate] gpgunm <[email protected]>
ssb   rsa4096/078974E15960FC14 2023-10-27 [E] [expires: 2025-10-26]

me@my-macbook myproject % git config --global user.signingkey CMC8D2G96B994245
me@my-macbook myproject % git commit -m "Fix vulns"
error: Couldn't load public key CMC8D2G96B994245: No such file or directory?

fatal: failed to write commit object
me@my-macbook myproject %

正如你所看到的,我列出了密钥,并尝试设置我的歌唱密钥,但是当我提交时 git 说它无法加载公钥,因为没有这样的文件或目录。

git
  • 1 个回答
  • 15 Views
Martin Hope
chargerstriker
Asked: 2023-07-10 23:07:02 +0800 CST

git-show-branch 输出显示在我的 git 提示符中

  • 6

当我导航到 git 存储库的目录时,我的命令行显示了很多内容。它看起来像 git-show-branch 的输出。我尝试编辑我的 git 配置文件来更改 [show-branch] 的默认值,但无济于事。我的提示中列出了大约 40 个提交,这确实很麻烦。有人知道如何让我的提示恢复到默认值吗?

操作系统是RHEL。

我的提示如下(## 替换敏感信息):

on ! [backup-master] This is the fixes I need!
 ! [checkout] Added ## and ##. This commit may be garbage
  * [master] Merge branch 'master' of /home/path/path
   ! [oldRval] Added top level cells ## and ##
----
  -  [master] Merge branch 'master' of /home/path/path
  *  [master^2] Changes to ## and level ##. Modified ## boost architecture
  *  [master^2^] Changes to all ##, some ##, many ##
  *  [master^2~2] many schematic changes. Updated ##. Updated ##
  *  [master~2] placement update done. ## done update and ongoing ## errors.
  *  [master~3] ongoing block
  *  [master~4] Updates to ##. Updated to ## for cleaner layout.
  *  [master~5^2] final fixes on ##. Separated ##.
  *  [master~5^2^] This is the fixes I need
  *  [master~6] Updated ##, ## and some ## with ## versions
+    [backup-master] this is the fixes I need
++*  [checkout] Added XX and ## . This commit may be garbage
++*+ [oldRval] Added top level cells ## and ##
git
  • 1 个回答
  • 30 Views

Sidebar

Stats

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

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Vickel Firefox 不再允许粘贴到 WhatsApp 网页中? 2023-08-18 05:04:35 +0800 CST
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve