总行后 git push 挂起
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15843937/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git push hangs after Total line
提问by Patrick
My git push is hanging after appearing to complete the push. I am going git push
我的 git push 在完成推送后挂起。我要去 git push
Counting objects: 51, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (47/47), done.
Writing objects: 100% (47/47), 27.64 MiB | 6.47 MiB/s, done.
Total 47 (delta 4), reused 0 (delta 0)
It hangs here and I have to control-c to get back to command line. I have made several commits in the past with this project with now issues. I have tried other repos on my machine and they work fine. What is going on here?
它挂在这里,我必须使用 control-c 才能返回命令行。我过去曾在这个项目中进行过几次提交,但现在有问题。我在我的机器上尝试过其他存储库,它们工作正常。这里发生了什么?
回答by Patrick
This turned out to be no problem at all. I simply had to wait until the upload was complete. I had added several large files and there is not a progress indicator. Maybe someone else will find this helpful.
结果证明这完全没有问题。我只需要等到上传完成。我添加了几个大文件,但没有进度指示器。也许其他人会发现这很有帮助。
回答by Alim ?zdemir
It can be (as the accepted answer suggests) just a moment to wait, but in the majority of cases it is linked to permissions on the remote. While mostly a non-issue on public git services such as GitHub, Gitlab or Bitbucket, self-hosted remotes might have a special user, or a group for access.
可以(正如公认的答案所暗示的那样)等待片刻,但在大多数情况下,它与远程权限相关联。虽然在公共 git 服务(如 GitHub、Gitlab 或 Bitbucket)上大多不是问题,但自托管远程s 可能有一个特殊的用户或一个访问组。
And on new bare repositories it doesn't suffice to change the folder,
but instead needs to be recursive because of .git
-Folder inside.
在新的裸存储库上,更改文件夹是不够的,而是需要递归,因为.git
里面有-Folder。
回答by cherrysoft
Permissions can also be cause of this in the case of a bare repo on a remote machine.
在远程机器上的裸仓库的情况下,权限也可能是导致这种情况的原因。
回答by pal4life
It only worked for me in the case when I did
git push -u origin master
, when I just simply used git push
for bit bucket, it did not push through.
它只在我这样做的情况下对我
git push -u origin master
有用,当我只是简单地用于git push
位桶时,它没有通过。
回答by gordey4doronin
Waiting until the upload finished doesn't work for me. I pushed not very big file, but waited long enough, still hanged.
等到上传完成对我不起作用。我推了不是很大的文件,但等了够久,还是挂了。
What helped for me is updating from msysgit 1.9.5
to git-for-windows 2.6.2
.
对我有帮助的是从 更新msysgit 1.9.5
到git-for-windows 2.6.2
.
回答by codemania23
The problem is that the upload file is big.
问题是上传文件很大。
Either you wait it out or go to your project folder and delete all the libraries which you could find in the target folder if using maven. Then do the push and it will happen quickly.
要么等待它,要么转到项目文件夹并删除所有可以在目标文件夹中找到的库(如果使用 maven)。然后做推动,它会很快发生。
Anyways, the library folders need not be stored in git, it's just a waste of git space unless and until they are not available in the maven repositories and you really need to store them
无论如何,库文件夹不需要存储在 git 中,这只是浪费 git 空间,除非并且直到它们在 maven 存储库中不可用并且您确实需要存储它们
回答by AndrewIsOffline
Just wanted to add this in case it helps anyone. I had the same problem, and the issue was that the git user didn't have permission to write to the files, only to read from them.
只是想添加这个以防万一它对任何人都有帮助。我遇到了同样的问题,问题是 git 用户没有写入文件的权限,只能读取它们。
回答by dzimney
This issue can be caused by issues with your SSH agent.
此问题可能是由 SSH 代理的问题引起的。
I recently ran into this issue because I changed my default shell from zsh
to bash
. I'd originally set up my ssh keys using zsh
, and so they were not available by default to bash
, using chsh -s /bin/bash
.
我最近就遇到了这个问题,因为我是从改变了我的默认的shellzsh
来bash
。我最初使用 设置我的 ssh 密钥zsh
,因此默认情况下它们不可用bash
,使用chsh -s /bin/bash
.
To fix, you'll need to add your ssh key(s) to the SSH authentication agent using the same shell script (bash
, sh
, zsh
, etc) you're using to perform your git commands:
要修复,则需要使用相同的shell脚本(您的SSH密钥(S)添加到SSH认证代理bash
,sh
,zsh
等),您使用的是执行您的Git命令:
eval `ssh-agent`
ssh-add ~/.ssh/some_key_rsa
You'll need to enter the passphrase for the key in order to add it. To store the passphrase to your user keychain so you don't need to enter it every time the key is used, add the key with the -K
option to the ssh-add
command.
您需要输入密钥的密码才能添加它。要将密码短语存储到您的用户钥匙串,以便您无需在每次使用密钥时都输入它,请将带有-K
选项的密钥添加到ssh-add
命令中。
ssh-add -K ~/.ssh/some_key_rsa
Note the uppercase K
as using a lowercase is a different command option.
请注意大写,K
因为使用小写是不同的命令选项。
回答by jmarks
I ran into this same problem while pushing to GitHub. I found that a subset of the files being pushed wasn't being accepted.
我在推送到 GitHub 时遇到了同样的问题。我发现被推送的文件的一个子集不被接受。
I found this out by breaking my large commit into smaller commits (as described in this SO question: Break a previous commit into multiple commits), and then finding success with most of the smaller pieces.
我通过将我的大提交分解为较小的提交来发现这一点(如这个问题中所述:将先前的提交分解为多个提交),然后在大多数较小的部分中取得成功。
The problem piece contains image files and I'm still sorting out which particular file (or files) triggers the problem.
问题部分包含图像文件,我仍在整理触发问题的特定文件(或文件)。
回答by float13
I wanted to second @Fabio's comment to the original post - that solved it for me.
我想第二个@Fabio 对原始帖子的评论 - 这为我解决了这个问题。
I'm running my own ad hoc local git server on Raspberry Pi. I forgot to chown
the new bare repo, and pushing the first commit from a remote PC would just hang indefinitely.
我正在 Raspberry Pi 上运行我自己的临时本地 git 服务器。我忘记chown
了新的裸仓库,并且从远程 PC 推送第一次提交只会无限期挂起。
This fixed it (running chown
as root or with sudo
):
这修复了它(chown
以 root 或 with运行sudo
):
cd /srv/git
chown git:git -R <repo_name>.git
Replacing <repo_name>
with the name of your repo.
替换<repo_name>
为您的仓库名称。