5

I'm messing around with git for the first time on my PC. I have one repository in D:\MyProjectA\, and a bare clone of the repository in D:\MyProjectB\. Then I setup the bare clone to be origin by running remote add origin D:\MyProjectB.

Now I've made some changes to MyProjectA and want to push them back to origin. When I run git push origin master in Powershell, I see the following output, but the script doesn't exit. I have to Ctrl-C to close. What's going on?

PS D:\MyProjectA> git push origin master
Counting objects: 3, done.
Delta compression using up to 16 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 290 bytes | 290.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
cbp
  • 25,252
  • 29
  • 125
  • 205

1 Answers1

2

Just to check, would the same command work with no pager?

git --no-pager push origin master

If so, type:

git config --global core.pager more.com

Also, with Git 2.16 (recently released), try:

$env:GIT_REDIRECT_STDERR = "2>&1"

And see if that helps.

Finally, setting various GIT_TRACE variables can help debug the command.

The OP cbp confirms in the comments:

I have just had success in CMD (not Powershell) using GIT_TRACE.
And what I observed is that it hung for a long time running git pack-objects. Eventually it finished and exited.
Subsequently, running git push appears to be much faster.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Hi, thanks for your help. Unfortunately the behaviour is the same with --no-pager. Will try upgrading Git and see if redirecting STDERR helps. – cbp Jan 21 '18 at 06:59
  • I tried `set GIT_REDIRECT_STDERR="2>&1"` (after upgrading to 2.16), but the behaviour is the same unfortunately. – cbp Jan 21 '18 at 07:04
  • Hmm I don't see any trace messages... but I'm not sure if the tracing is working as I can't see any tracing for any commands I run. I tried both `set GIT_REDIRECT_STDERR="2>&1"` and `set GIT_TRACE=1` but am seeing no observable difference in output for any commands. – cbp Jan 21 '18 at 07:20
  • @cbp Maybe a stderr issue. I suppose the push alone works well when done from a simple CMD? – VonC Jan 21 '18 at 07:23
  • No it exhibits the same behaviour in CMD as in Powershell - and no evidence of anything going to STDERR. – cbp Jan 21 '18 at 07:24
  • @cbp Can you try again, in a CMD, after setting a simplified PATH: https://stackoverflow.com/a/47826648/6309 – VonC Jan 21 '18 at 07:26
  • Ahh... I have just had success in CMD (not Powershell) using GIT_TRACE. And what I observed is that it hung for a long time running `git pack-objects`. _Eventually_ it finished and exited. Subsequently, running `git push` appears to be much faster. I guess that explains it! – cbp Jan 21 '18 at 07:30
  • I notice your helping me on another similar, but different question about git plus Dropbox (https://stackoverflow.com/questions/48364494/cant-push-to-git-repository-in-dropbox-under-boxcryptor). Unfortunately that question is still unresolved. Appreciated your help :) – cbp Jan 21 '18 at 07:32
  • @cbp Great! I have included your comment in the answer for more visibility. Now, for that other question... – VonC Jan 21 '18 at 07:56