gpt4 book ai didi

linux - 尝试推送到我的 Linux AWS 服务器上的裸仓库时出现 'insufficient permission...' 错误

转载 作者:太空狗 更新时间:2023-10-29 12:01:38 24 4
gpt4 key购买 nike

更新 (11/4):只是为了测试它是否确实是我的 linux 机器上的权限问题,

在 AWS Linux 裸存储库中,我执行了“sudo chmod -R 777”。并且能够成功完成“git push origin master”,我立即执行了“sudo chmod -R 770”。更改权限。

我在尝试推送到我的 Linux AWS 服务器上的裸存储库时遇到“权限不足...”错误。

  $ git push origin master
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 622 bytes | 0 bytes/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: error: insufficient permission for adding an object to repository database objects
remote: fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To awsDev:/AWSbareRepo
! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'awsDev:/AWSbareRepo'

我可以 pull ,但不能推。我已经完成了一个“git ls-remote”,它可以很好地返回远程存储库中的可用引用以及相关的提交 ID,因此连接不是问题。

我还在 .config 文件中将 core.sharedRepository 设置为 true:

[core]
repositoryformatversion = 0
filemode = true
bare = true
sharedRepository = true
~
~
~

在我的 AWS linux 服务器上的裸 repo 目录中,我执行了“ls -la”并收到以下信息:

$ ls -la
total 40
drwxr-xr-x 7 root root 4096 Nov 4 04:56 .
dr-xr-xr-x 28 root root 4096 Oct 14 02:06 ..
drwxrwsr-x 2 root root 4096 Apr 16 2015 branches
-rwxrwSr-- 1 root root 91 Nov 4 04:56 config
-rw-rwSr-- 1 root root 73 Apr 16 2015 description
-rw-rwSr-- 1 root root 23 Apr 16 2015 HEAD
drwxrwsr-x 2 root root 4096 Apr 16 2015 hooks
drwxrwsr-x 2 root root 4096 Apr 16 2015 info
drwxrwsr-x 12 root root 4096 Oct 14 03:21 objects
drwxrwsr-x 4 root root 4096 Apr 16 2015 refs

我已经通过 ssh 连接到我的服务器并尝试阅读 Git Push Error: insufficient..问题,但不确定我需要授予哪个组的权限?我是否需要在我的 AWS 服务器上添加一个与我的开发箱上的组相匹配的新组?

附加信息:如果我不清楚,我正在尝试从本地开发箱到 AWS linux 服务器的“git push origin master”。推送来 self 的本地 DEV 框,当我尝试推送时,我没有通过 SSH 进入我的 AWS Linux 框。

不确定这是否必要,但我的 AWS Linux 服务器有 IP 规则,这会阻止任何不是来 self 的 IP 地址的 SSH 连接。

最佳答案

(此答案假设您正在使用 ssh+git 连接到存储库。)

当您通过 ssh 登录 AWS 时,尝试输入 id。这将为您提供登录用户的用户 ID。发现后,通过(在存储库内)更改存储库的权限

chown -R user_id:user_id .

这会将存储库中所有文件的所有权更改为您登录的用户。 (:user_id 也会更改组所有权)

说明:您的存储库归 root 所有。除非您也以 root 身份登录,否则您将没有写入权限。

关于linux - 尝试推送到我的 Linux AWS 服务器上的裸仓库时出现 'insufficient permission...' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33514186/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com