Git:不能从一台电脑上推

时间:2023-02-06 16:23:38

One of my coworkers is having a problem pushing changes from git on his machine. If he logs into another machine, he can push just fine - but from his machine, when he tries to push he gets the following error

我的一个同事在他的机器上从git推送更改时遇到了问题。如果他登录到另一台机器,他可以推得很好 - 但是从他的机器,当他试图推动他得到以下错误

    D:\Projects\test1\best-practices>git push
    Counting objects: 4, done.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (3/3), 273 bytes, done.
    Total 3 (delta 1), reused 0 (delta 0)
    error: unable to create temporary sha1 filename ./objects/42: Permission denied

    fatal: failed to write object
    error: unpack failed: unpacker exited with error code
    To //civ3s012/gitrepos/best-practices/.git
     ! [remote rejected] master -> master (n/a (unpacker error))
    error: failed to push some refs to '//civ3s012/gitrepos/best-practices/.git'

The server is a windows machine, as is the client. No one else is having this problem - it seems to be a server permissions issue, but we've ruled that out as far as we can tell. Also, the fact that he can log into a different machine and push, using the same username, makes it seem like it's not server permissions. Any ideas what could be going wrong here?

服务器是Windows机器,客户端也是如此。没有其他人遇到这个问题 - 这似乎是一个服务器权限问题,但我们已经根据我们的判断排除了这一点。此外,他可以使用相同的用户名登录到另一台计算机并进行推送,这使得它看起来不是服务器权限。有什么想法可能会出错吗?

6 个解决方案

#1


I'm not a windows user so I'm stabbing in the dark a little here. It looks like the remote file system is mounted and you're just pushing to that (not using ssh:// or git://). Is that FS somehow mounted readonly? Can he create/modify files on there (outside of git)?

我不是一个Windows用户,所以我在这里暗了一点。它看起来像是安装了远程文件系统,你只是推动它(不使用ssh://或git://)。这个FS以某种方式安装只读吗?他可以在那里创建/修改文件(在git之外)吗?

#2


Try adding this configuration variable to the remote repository:

尝试将此配置变量添加到远程存储库:

 $ git config core.sharedRepository "all"
 $ git config receive.denyNonFastForwards True

These are usually set by the --shared option in git init, when the repo is set up.

当设置repo时,这些通常由git init中的--shared选项设置。

I don't know how windows permissions interact, so I'm not sure that this is the solution. But I know that sometimes a linux user can create files with permissions that fail in a Git remote in exactly this way. It happened when they belong to the proper group but don't have it as their primary group. Setting the repo sharing to all gets around this.

我不知道Windows权限如何交互,所以我不确定这是解决方案。但我知道有时Linux用户可以用这种方式创建具有Git远程失败权限的文件。它发生在他们属于适当的群体但没有作为他们的主要群体时。将repo共享设置为all可以解决这个问题。

This seems happen with shared repos imported from SVN or CVS.

这似乎发生在从SVN或CVS导入的共享存储库中。

#3


I know this is the easy-peasy sysadmin blowoff answer, but have you verified that his harddrive isn't full?

我知道这是一个简单易用的系统管理员吹嘘答案,但你确认他的硬盘驱动器没有装满吗?

#4


The problem ended up being a stored password for that share which allowed read access, but not write access. Even when we explicitly mounted the drive with the appropriate username and password, the stored password must have been used in the background, which made this difficult to track down. To clear the password, we went to Control Panel, User Accounts, clicked on Advanced, Manage Passwords, and removed the logon information for the server in question. After that, everything worked as it should. I'm accepting Pat Notz's answer, since it did end up being a read-only FS. Thanks!

该问题最终成为该共享的存储密码,允许读访问,但不允许写访问。即使我们使用适当的用户名和密码显式安装驱动器,也必须在后台使用存储的密码,这使得难以追踪。要清除密码,我们转到控制面板,用户帐户,单击高级,管理密码,并删除相关服务器的登录信息。在那之后,一切都按预期工作。我接受了Pat Notz的回答,因为它最终成为了一个只读FS。谢谢!

#5


Maybe he's created a branch in his local repo that already exists on the server and that ref can't be updated because it was created by someone else?

也许他在他的本地仓库中创建了一个已经存在于服务器上的分支,并且ref无法更新,因为它是由其他人创建的?

#6


Another brain dead answer. You sure you have permissions to read those files? Has happened to me a few times where I'll make a change as another user by mistake. Then later I can't push. Chown is your friend.

另一个脑死的答案。您确定您有权读取这些文件吗?发生在我身上几次,我会误将其作为另一个用户进行更改。然后我不能推。 Chown是你的朋友。

#1


I'm not a windows user so I'm stabbing in the dark a little here. It looks like the remote file system is mounted and you're just pushing to that (not using ssh:// or git://). Is that FS somehow mounted readonly? Can he create/modify files on there (outside of git)?

我不是一个Windows用户,所以我在这里暗了一点。它看起来像是安装了远程文件系统,你只是推动它(不使用ssh://或git://)。这个FS以某种方式安装只读吗?他可以在那里创建/修改文件(在git之外)吗?

#2


Try adding this configuration variable to the remote repository:

尝试将此配置变量添加到远程存储库:

 $ git config core.sharedRepository "all"
 $ git config receive.denyNonFastForwards True

These are usually set by the --shared option in git init, when the repo is set up.

当设置repo时,这些通常由git init中的--shared选项设置。

I don't know how windows permissions interact, so I'm not sure that this is the solution. But I know that sometimes a linux user can create files with permissions that fail in a Git remote in exactly this way. It happened when they belong to the proper group but don't have it as their primary group. Setting the repo sharing to all gets around this.

我不知道Windows权限如何交互,所以我不确定这是解决方案。但我知道有时Linux用户可以用这种方式创建具有Git远程失败权限的文件。它发生在他们属于适当的群体但没有作为他们的主要群体时。将repo共享设置为all可以解决这个问题。

This seems happen with shared repos imported from SVN or CVS.

这似乎发生在从SVN或CVS导入的共享存储库中。

#3


I know this is the easy-peasy sysadmin blowoff answer, but have you verified that his harddrive isn't full?

我知道这是一个简单易用的系统管理员吹嘘答案,但你确认他的硬盘驱动器没有装满吗?

#4


The problem ended up being a stored password for that share which allowed read access, but not write access. Even when we explicitly mounted the drive with the appropriate username and password, the stored password must have been used in the background, which made this difficult to track down. To clear the password, we went to Control Panel, User Accounts, clicked on Advanced, Manage Passwords, and removed the logon information for the server in question. After that, everything worked as it should. I'm accepting Pat Notz's answer, since it did end up being a read-only FS. Thanks!

该问题最终成为该共享的存储密码,允许读访问,但不允许写访问。即使我们使用适当的用户名和密码显式安装驱动器,也必须在后台使用存储的密码,这使得难以追踪。要清除密码,我们转到控制面板,用户帐户,单击高级,管理密码,并删除相关服务器的登录信息。在那之后,一切都按预期工作。我接受了Pat Notz的回答,因为它最终成为了一个只读FS。谢谢!

#5


Maybe he's created a branch in his local repo that already exists on the server and that ref can't be updated because it was created by someone else?

也许他在他的本地仓库中创建了一个已经存在于服务器上的分支,并且ref无法更新,因为它是由其他人创建的?

#6


Another brain dead answer. You sure you have permissions to read those files? Has happened to me a few times where I'll make a change as another user by mistake. Then later I can't push. Chown is your friend.

另一个脑死的答案。您确定您有权读取这些文件吗?发生在我身上几次,我会误将其作为另一个用户进行更改。然后我不能推。 Chown是你的朋友。