57

当我试图推送到我的远程 git 存储库时,它需要永远并且没有任何反应。我等了这么久,但推送永远不会完成。我的操作系统是 Ubuntu 12.10。谢谢你。

4

9 回答 9

65

尝试使用该--verbose选项来查看实际发生的情况。即使你做了一些小的改动,一些内部的事情也可能导致 git 推送更多的数据。

看看git gc。它会清理您的本地存储库并可能会加快速度,具体取决于您的问题。强烈建议备份。

于 2013-03-04T10:05:27.140 回答
11

我有同样的问题。如果您使用的是 Bitbucket.org,我不知道为什么,但禁用 IPV6 连接解决了问题。

于 2018-12-13T19:44:06.027 回答
7

确保您使用正确的协议。

根据您设置本地配置的方式,您可能需要使用https来连接。为此,请将远程存储库的协议从git@github.com:[user]/[repo]协议切换到https://github.com/[user]/[repo].git协议。

https此外,如果您无法使用该协议,反之亦然也值得尝试。在较旧的配置上,较旧的git@github用户身份验证通常允许您作为后备连接。

于 2014-07-18T20:33:09.973 回答
3

确保您已通过 github 身份验证:对我来说,这是我的身份验证。我在 Windows 上使用 git bash 运行命令,出于某种原因,它没有提示我进行身份验证。当我用命令提示符运行它时,我得到了这个

Select an authentication method for 'https://github.com/':
1. Web browser (default)
2. Personal access token
option (enter for default):

在我成功验证后,它工作正常

于 2021-06-15T02:53:50.120 回答
2

我使用 git bash 也遇到过类似的问题。使用这些命令会有所帮助。

git config --global core.preloadindex true  
git config --global core.fscache true 
git config --global gc.auto 256

https://blog.praveen.science/solution-to-git-bash-is-very-slow-in-windows/

于 2021-06-16T11:27:33.010 回答
1

每次我重新安装或升级 Ubuntu(全部 3-4 次)时,我都必须转到我的互联网连接(以太网和 Wifi)的 DNS 设置,删除Automatic并添加8.8.8.81.1.1.1. 在重置git push和所有其他 git-origin-accessing 命令后,从 1 分钟下降到几秒钟。

于 2020-04-07T13:51:28.913 回答
1

请检查远程目录的权限。在我的情况下,通过 设置正确的权限后chown -R user.group /dir,提交正确完成:

$ git push --verbose
Pushing to ssh://user@domain.zone:port/dir
user@domain.zone'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'
于 2019-05-24T05:55:55.837 回答
1

一种可能性可能是您在最新提交中提交了大型二进制文件。git 不擅长处理二进制文件。如果提交二进制文件是一个错误,您可以参考以下答案以摆脱提交中的二进制文件。

https://stackoverflow.com/a/58987943/8694152

于 2019-11-22T05:24:38.490 回答
0

删除这些目录中与关键字“vcs”和“git”相关的每个设置文件(在搜索栏中搜索“vcs”和“git”并删除您在结果中看到的每个文件):

  1. C:/Users/%USER%/AppData/Local/Google/AndroidStudio%VERSION%

  2. C:/Users/%USER%/AppData/Roaming/Google/AndroidStudio%VERSION%

然后重启IDE!

于 2021-12-17T18:38:56.947 回答