Git 推送需要永远
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15175715/
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 takes forever
提问by Codeformer
When I am trying to push to my remote git repository, but it is taking forever and nothing happens. I waited for so long, but push is never getting finished. My OS is Ubuntu 12.10. Thank you.
当我尝试推送到我的远程 git 存储库时,但它需要永远并且没有任何反应。我等了这么久,但推送永远不会完成。我的操作系统是 Ubuntu 12.10。谢谢你。
回答by phisch
Try using the --verbose
option to see what actually happens. Even if you did small changes, some internal things might cause git to push a lot more data.
尝试使用该--verbose
选项查看实际发生的情况。即使你做了一些小的改动,一些内部的事情也可能会导致 git 推送更多的数据。
Have a look at git gc. It cleans up your local repository and might speed up things, depending on you issue. Backup strongly advised.
看看git gc。它会清理您的本地存储库并可能会加快速度,具体取决于您的问题。强烈建议备份。
回答by Tony Brasunas
Ensure you're using the right protocol.
确保您使用正确的协议。
Depending on how you have your local configurations set up, you might need to use https
to connect. To do so, switch the protocol for the remote repository from the [email protected]:[user]/[repo]
protocol to the https://github.com/[user]/[repo].git
protocol.
根据您设置本地配置的方式,您可能需要使用https
来连接。为此,请将远程存储库的[email protected]:[user]/[repo]
协议从协议切换到https://github.com/[user]/[repo].git
协议。
Also, it's worth trying vice versa, if you're unable to use the https
protocol. On older configurations, the older git@github
user authentication will often allow you to connect as a fall back.
此外,如果您无法使用该https
协议,反之亦然值得尝试。在较旧的配置中,较旧的git@github
用户身份验证通常允许您作为后备连接。
回答by Felipe Desiderati
I had the same problem. If you are using Bitbucket.org, I don't know why, but disabling IPV6 connection fixed the problem.
我有同样的问题。如果您使用的是 Bitbucket.org,我不知道为什么,但是禁用 IPV6 连接解决了这个问题。
回答by MS_
One possibility might be that you have large binary file(s) commited in the latest commit. git is not good at working with binary file. If commiting binary files was a mistake, you can refer to following answerfor getting rid of binary file in commit.
一种可能性可能是您在最新提交中提交了大型二进制文件。git 不擅长处理二进制文件。如果提交二进制文件是错误的,您可以参考以下答案以在提交中删除二进制文件。
回答by Bill Kotsias
Every time I reinstall or upgrade Ubuntu (all 3-4 times), I had to go to the DNS settings of my internet connection (both Ethernet and Wifi), remove Automatic
and add 8.8.8.8
and 1.1.1.1
. After a reset git push
and all other git-origin-accessing commands go down from 1 minute to a few seconds.
每次我重新安装或升级 Ubuntu(全部 3-4 次)时,我都必须转到 Internet 连接(以太网和 Wifi)的 DNS 设置,删除Automatic
并添加8.8.8.8
和1.1.1.1
. 重置后git push
,所有其他 git-origin-accessing 命令都会从 1 分钟减少到几秒钟。
回答by Alexander Lubyagin
Please check the permission rights on the remote dir. In my case, after setting the correct permissions by chown -R user.group /dir
, the commit is correctly finished:
请检查远程目录的权限。就我而言,在通过 设置正确的权限后chown -R user.group /dir
,提交正确完成:
$ git push --verbose
Pushing to ssh://[email protected]:port/dir
[email protected]'s password:
Counting objects: ...
...
Total 123 (delta 21), reused 16 (delta 12)
To ssh://domain.zone:port/dir
* [new branch] master -> master
updating local tracking ref 'refs/remotes/origin/master'