Git推动是挑剔的 [英] Git push is finicky

查看:128
本文介绍了Git推动是挑剔的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用git时遇到了很多问题(另外,我是一个新手)。很多时候,当我试图推动我碰到错误。见下:

 计数对象:8,完成。 
使用多达4个线程的增量压缩。
压缩对象:100%(5/5),完成。
写作对象:100%(5/5),6.03 KiB | 0字节/秒,完成。
总计5(增量2),重用0(增量0)
远程:错误:将对象添加到存储库数据库的权限不足./objects
远程:致命:未能写入对象
错误:解包失败:解包对象异常退出
到/Volumes/batcave/sourceControl/x.git
! [remote rejected] master - > master(unpacker error)
错误:未能将一些文件推送到'/Volumes/batcave/sourceControl/x.git'

这个奇怪的部分是如果我输入:

  git reset --hard origin / master 

然后

  emacs testfile.txt 

并将文本输入到testfile.txt中,然后执行以下操作:

  git add。 
git commit -a -madded testfile.txt
git push

推动工程。所以我不买它是因为我没有得到适当的许可。此外,有时如果我只是打开文件,我遇到了问题,推入emacs并添加和删除一些回报,然后它的工作。



有关更多信息,我正在使用git存储库来保持我的台式机和笔记本电脑的同步。 >解决方案

您正在使用看起来是已安装的文件系统的系统跨越权限模型。当系统与Mac OS和Windows不同时,这是不可取的。当你推动你写新文件和修改索引。通过共享访问,您可能会尝试将这些操作作为不同权限的用户。相反,您应该在两个系统之间使用网络协议,以便文件操作始终从相同的上下文执行。



如果代码是你不介意公开的东西,最快的方法是使用现有的免费git服务器,如 github 。这两个系统都会从主机上拉出来。这是我的建议。



否则,选择一个系统作为您的服务器,并在两个系统之间建立基于SSH密钥的身份验证,以便 git协议用于访问。本质上,这意味着客户端系统应该访问服务器,如拥有repo文件的user @ server。 (也有可能,尽管可能没有必要将两个对称设置为相互对称,以便两者都可以推或拉,两侧都使用SSH authorized_keys。)


I have been having a lot of issues using git (also, I'm a newb). Many times when I try to git push I run into errors. See below:

Counting objects: 8, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 6.03 KiB | 0 bytes/s, done.
Total 5 (delta 2), 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 /Volumes/batcave/sourceControl/x.git
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to '/Volumes/batcave/sourceControl/x.git'

The strange part about this is if I type:

git reset --hard origin/master

then

emacs testfile.txt

and enter text into the testfile.txt then do the usual:

git add .
git commit -a -m"added testfile.txt"
git push

that push works. So I don't buy it's that I don't have the proper permission. Also, sometimes if I just open the file that I was having problems pushing in emacs and add and delete some returns, then it works.

For further information, I'm using the git repository to keep my desktop pc and mac laptop synchronized.

解决方案

You are crossing permissions models between systems with what appears to be a mounted filesystem. This is inadvisable when the systems are as different as Mac OS and windows. When you are pushing you are writing new files and modifying indexes. By accessing via share, you are likely attempting those operations as a differently permissioned user. Instead you should be using a network protocol between the two systems so that the file operations are always executed from the same context.

If the code is stuff you don't mind being public anyway, the quickest approach would be to use an existing free git server like github. Both systems would pull and push from the host. This is my recommendation.

Otherwise, pick one system to be your "server" and set up SSH key-based authentication between the two systems so that the git protocol is used for access. Essentially this means that the client system should access the server as the user@server that owns the repo files. (It is also possible, though probably unnecessary to set up the two symmetric to each other such that both could push or pull, using SSH authorized_keys on both sides.)

这篇关于Git推动是挑剔的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆