linux - GIT 未在替代用户下运行 -/bin/git :/bin/git: cannot execute binary file

标签 linux git

我刚刚在我的 CentOS 6 上安装了 git (yum install)。我想克隆一个存储库,但请记住,以 root 用户身份运行 GIT 是不安全的,我尝试以管理员身份执行此操作(我真的不记得其密码)。以下是命令流程。

[root@angkor public_html]# runuser -l admin 'git'
/bin/git: /bin/git: cannot execute binary file
[root@angkor public_html]# su - admin git
Last login: Tue May 28 11:00:08 UTC 2019 on pts/0
/bin/git: /bin/git: cannot execute binary file
[root@angkor public_html]# git
usage: git [--version] [--help] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]

正如我们所看到的,当我以 root 身份运行 git 时它启动了,但是当我尝试以管理员身份运行它时报告了一些错误。为什么以及如何修复它?

最佳答案

不幸的是,这是意料之中的:

https://bugzilla.redhat.com/show_bug.cgi?id=1245780

改用这个:

runuser -l admin -c 'git'

关于linux - GIT 未在替代用户下运行 -/bin/git :/bin/git: cannot execute binary file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56341135/

相关文章:

linux - wget连接中断

Python 编译错误 : "LONG_BIT definition appears wrong for platform"

c++ - fstream 中的 linux 路径

git - FETCH_HEAD 引用在 "git fetch"之后未正确更新

python - 动态 Python 倒数计时器

python tornado用户认证,然后通过apache反向代理

macos - 从终端使用适用于 Mac 的 Github GUI 和 git

git - 用自己的 fork 交换 git 子模块

svn - SVN 能做什么 Git 不能?

git - Flake8 配置未在 git hook 中应用