Git push 不工作,没有错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35077787/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 11:44:49  来源:igfitidea点击:

Git push not working, no error

gitbitbucket

提问by Dave

I am trying to push my commits to Bitbucket using the command

我正在尝试使用命令将我的提交推送到 Bitbucket

git push origin master

Nothing happens. I am represented with a command prompt, and no error message. When I browse the source online, my code has not been uploaded.

没发生什么事。我用命令提示符表示,没有错误消息。当我在线浏览源代码时,我的代码还没有上传。

git remote show

returns "origin"

返回“原点”

git push --verbose

Does not show any additional information.

不显示任何附加信息。

I have pushed many times using this method, but it suddenly just stopped working.

我用这种方法推了很多次,但它突然停止工作。

I am using 2.6.1.windows.1on Windows 10

2.6.1.windows.1在 Windows 10 上使用

UPDATE: It appears to a problem with Git itself. I can't push, pull, or clone any repository on both GitHub or Bitbucket. It seems that any git command that connects to a remote isn't working.

更新:这似乎是 Git 本身的问题。我无法在 GitHub 或 Bitbucket 上推送、拉取或克隆任何存储库。似乎任何连接到远程的 git 命令都不起作用。

I tried uninstalling and reinstalling git. I tried installing both, 2.6.1 and 2.7.0 (2.7 didn't even install properly on Windows 10 Build 14251). I can interact with the repo without an issue on other computers.

我尝试卸载并重新安装 git。我尝试安装 2.6.1 和 2.7.0(2.7 甚至没有在 Windows 10 Build 14251 上正确安装)。我可以与 repo 交互,而不会在其他计算机上出现问题。

回答by vidriduch

I had the same error, push/pull/clone would execute with no errors, no feedback, but nothing happended. What helped was to install latest GIT and when option "Choosing HTTPS transport backend" option came up I have selected "Use the native Winbdows Secure Channel library" and it all worked again ... Hope this help someone.

我有同样的错误,推/拉/克隆会执行没有错误,没有反馈,但什么也没发生。有帮助的是安装最新的 GIT,当出现选项“选择 HTTPS 传输后端”选项时,我选择了“使用本机 Winbdows 安全通道库”,一切都再次正常工作......希望这对某人有所帮助。

enter image description here

在此处输入图片说明

回答by VonC

Check if you are in a detached HEADmode (git symbolic-ref --short -q HEADis empty), which would explain why a git push fails silently.

检查您是否处于分离的 HEAD模式(git symbolic-ref --short -q HEAD为空),这将解释 git push 静默失败的原因。

If you do have a legitimate branch checked out, then the other test is to make a new clone, import your changes and try to push from that new clone to see if the issue persists.

如果您确实检查了一个合法分支,那么另一个测试是创建一个新的克隆,导入您的更改并尝试从该新克隆推送以查看问题是否仍然存在

git clone /url/repo
git remote add work ../previousrepo
git fetch work
git reset --hard work/master
git push -u origin master

回答by Siggytron

I had a similar problem with my git pushes and git commits not showing up on Bitbucket.

我的 git pushes 和 git commits 没有出现在 Bitbucket 上也有类似的问题。

Problem specifics: My Bitbucket updates had been working fine. I stopped working on the project for a day or two in my environment (Cloud9 in this case). When I resumed, my Cloud9 terminal showed that I was in the correct branch when I typed the command:

问题细节:我的 Bitbucket 更新工作正常。我在我的环境(在本例中为 Cloud9)中停止了该项目的一两天工作。当我恢复时,当我输入命令时,我的 Cloud9 终端显示我在正确的分支中:

git status

However, no changes appeared in my Bitbucket branch.

但是,我的 Bitbucket 分支中没有出现任何变化。

My solution:

我的解决方案:

  • Within Bitbucket, click on "Branches" either on the side panel or within the main window.
  • You will see your branches. Click on the branch you're working in your environment, and that you want to push into.
  • Once inside the desired branch, there should be a button in the top right (unless they change the template) called "Checkout." Click on that.
  • Bitbucket provides the following message: Check out this branch on your local machine to begin working on it. It also provides the following code to type or paste into your terminal:

    git fetch && git checkout static-pages
    
  • Run that command in your terminal.

  • This should reset the connection.
  • Try your git push. It should work now.
  • 在 Bitbucket 中,单击侧面板或主窗口中的“Branches”。
  • 你会看到你的分支。单击您在环境中工作的分支,并且要推送到该分支。
  • 一旦进入所需的分支,右上角应该有一个名为“Checkout”的按钮(除非他们更改模板)。点击那个。
  • Bitbucket 提供以下消息:检查本地计算机上的此分支以开始处理它。它还提供以下代码以键入或粘贴到您的终端中:

    git fetch && git checkout static-pages
    
  • 在终端中运行该命令。

  • 这应该重置连接。
  • 试试你的 git push。它现在应该可以工作了。

回答by ahmed

This is an issue in Bitbucket:

这是 Bitbucket 中的一个问题:

https://bitbucket.org/site/master/issues/7567/git-push-remote-end-hung-up

https://bitbucket.org/site/master/issues/7567/git-push-remote-end-hung-up

Edit: i solved the issue by using SSH Tunneling:

编辑:我通过使用 SSH 隧道解决了这个问题:

% proxychains git push -u origin master  
ProxyChains-3.1 (http://proxychains.sf.net)
|DNS-request| bitbucket.org 
|S-chain|-<>-127.0.0.1:1080-<><>-4.2.2.2:53-<><>-OK
|DNS-response| bitbucket.org is 104.192.143.3
|S-chain|-<>-127.0.0.1:1080-<><>-104.192.143.3:22-<><>-OK
Counting objects: 3388, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (1089/1089), done.
Writing objects: 100% (3388/3388), 2.79 MiB | 85.00 KiB/s, done.
Total 3388 (delta 2312), reused 3343 (delta 2281)
To [email protected]:username/web-app.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

回答by theresawalrus

This is a open issue in Bitbucket, as @ahmed says. The updated open issue is here.

正如@ahmed 所说,这是 Bitbucket 中的一个悬而未决的问题。更新的未解决问题在这里

They recommend power cycling your modem. Alternatively, you can use a different wifi source, which worked for me.

他们建议您重启调制解调器。或者,您可以使用不同的 wifi 源,这对我有用。