mehdok
mehdok

Reputation: 1608

Stuck at push, nothing happens

I used to use git before without any problems, but suddenly I can't push or clone anything. When I use this command, nothing happens, not even an error, so I have to press ctrl + c or just close the git window.

I use this simple command for pushing:

git push origin master

Also tried with -u parameter.

  1. I opened port 22 in my firewall, no luck
  2. I used both http and ssh, again no luck
  3. I installed a new version of git, no luck

So, what can I do to solve this?

Update:

I installed a fresh copy of Win XP on virtual machine and tried to push something, same result as before, so maybe there's a problem with my internet connection.

Any ideas?

Upvotes: 23

Views: 75750

Answers (14)

Agnel Vishal
Agnel Vishal

Reputation: 572

I had messed with multiple repositories and for some reason the force argument solved the problem.

git push --force origin master

Upvotes: 1

Juanma
Juanma

Reputation: 676

I had the same problem. It was an IPv4/IPv6 issue. I had to force the SSH to use IPv4.

Set or add AddressFamily inet in /etc/ssh/ssh_config to force IPv4 connection.

More information about this here.

Upvotes: 0

Samwise Ganges
Samwise Ganges

Reputation: 552

Just in case anyone else made this silly mistake, I thought I had this issue but it was just because I wasn't used to the way VSCode asks for credentials in bash terminal now.

If you're using VSCode with bash terminal and you do git pull, it will just go to a new blank line, but it will also create a little form dialog at the very top of the screen asking for you to type your username, then password for the repository. I didn't see it because I was looking at the bottom of the screen where the terminal was. That and I'm on a very laggy XRDP session. Doh!

Upvotes: 0

林韋彤
林韋彤

Reputation: 21

git config --global credential.helper manager

Follow @VonC's solution. I got the stuck while doing git push and git pull, this works for me.

Upvotes: 0

Pana
Pana

Reputation: 79

This worked for me.

git config --global credential.helper manager
git config --global user.name "Your Name"
git config --global user.email "[email protected]"

Upvotes: 0

jasonleonhard
jasonleonhard

Reputation: 13887

Here is a little out of the box thinking.

Do you have a VPN on?

Close all of your applications including the VPN and terminal then try again.

It is amazing how many times just turning things off then on has helped at times, sometimes things just get stuck and need a "power start" may it serve you as well too.

Upvotes: 13

Pinak Ganguly
Pinak Ganguly

Reputation: 21

This is an issue with the installation may be with the latest GIT version(2.32.0).

To fix it, you have to reinstall git and select the highlighted option when this screen comes up.

Upvotes: 2

VonC
VonC

Reputation: 1324347

Update 2021: this is again an issue, when pushing with HTTPS URL, with Git 2.32 (June 2021).

See details here: there is a bug with the Microsoft Git Credential Manager Core, which is why, as Pinak Ganguly suggests, you might want to switch temporarely to the obsolete Git Credential Manager:

git config --global credential.helper manager

First, there was some issue with ssh access recently:

We are currently investigating SSH access problems on one of our fileserver pairs. A small number of repositories may be affected.

Second, you would need to try and use https, not http:

git remote set-url origin https://github.com/username/reponame

Third, the git push -u origin master is only for the first push (after that, git push alone is enough: see "Why do I need to explicitly push a new branch?" for more)

If the push or clone issue still persists, then you need to contact GitHub support to know more about this.

Upvotes: 22

Matoeil
Matoeil

Reputation: 7289

In my case the https connection was not working. Change remote origin url, not using https but git

git remote set-url origin [email protected]:username/reponame.git

This url can be found on your github or gitlab project page

Upvotes: 8

Nazmul Hoque
Nazmul Hoque

Reputation: 970

Recently I have faced the same problem and I solved the problem following bellow steps

  1. Make sure you have put the correct user name and email.

    git config --global user.name "Your Name"
    git config --global user.email "[email protected]"
    
  2. Now run this command

    git config --list
    
  3. You will see the output like this

    user.name=Your Name
    [email protected]
    
  4. Finally it works for me

Upvotes: 0

yeshengm
yeshengm

Reputation: 557

It turns out that the root cause might be the underlying network devices/drivers. Try rebooting your machine; or as a workaround add the following to your ~/.ssh/config:

Host *
IPQoS lowdelay throughput

Upvotes: 1

Augusto
Augusto

Reputation: 2222

It maybe be related to yout ssh client. Can you ssh login the a remote server? The -v verbose option is very usefull here.

ssh -v -p PORT USER@SERVER

More details here: https://stackoverflow.com/a/60205342/195812

Upvotes: 0

C. Griffin
C. Griffin

Reputation: 681

Just wanted to contribute yet another reason this can happen: if the remote you're pushing to has IP filters in place, it will blink with no output. In my case, my laptop was connected with WiFi which was not connecting through a whitelisted IP address.

Upvotes: 1

figs_and_nuts
figs_and_nuts

Reputation: 5753

Add

git remote set-url "https://github.com/targetusername/targetrepo"

after

git remote add "https://github.com/targetusername/targetrepo"

and before

git push -u origin master

Upvotes: 1

Related Questions