简体   繁体   中英

Git push origin master to remote repo asks for password three times and does nothing

I have a NAS on which I created a remote repository with the command git --bare init and I then clone this repository on my machine with the command git clone ssh://ID@PathToDistantRepo and it tells me that I have clone an empty repository.

So far I have no problem.

I add things, I make my commit, everything is fine, no error and the commit is present in the history.

But when I do git push origin master it asks me three times for the password of the ssh connection and then nothing. I let it run for half an hour and the prompt remains frozen without anything indicated.

If I add the "-verbose" option, nothing new.

If I run the git remote show origin It ask me the password and then show me this:

* remote origin
  Fetch URL: ssh://ID@PathToDistantRepo
  Push  URL: ssh://ID@PathToDistantRepo
  HEAD branch: (unknown)
  Local branch configured for 'git pull':
    master merges with remote master

I did not give you the exact URLs but they are good and I search the.net, but I must not know how to put the right keywords because I can not find anything.

Thank you in advance for your help.

Based on https://stackoverflow.com/a/32792843/4865273 restarting your SSH agent and sshd server may help.

Assuming you are on a Linux system, restart your SSH agent as follows.

First, find the agent PID:

eval "$(ssh-agent -s)"

This returns the PID number (eg, 1234). Use this number in the next command to kill the agent:

kill -9 1234

To restart the sshd service, see https://www.cyberciti.biz/faq/howto-restart-ssh/ If you use Ubuntu (systemd), you can simply execute: sudo systemctl restart ssh

If the problem specifically occurs when pushing large commits, try increasing the postBuffer:

git config --global http.postBuffer 2097152000 

This is known to solve similar issues, see https://stackoverflow.com/a/26663047/4865273

As you are asked 3 times to enter the SSH password, another solution may be to set up SSH keys for authentication instead of using a password. To do so, see https://www.cyberciti.biz/faq/how-to-set-up-ssh-keys-on-linux-unix

after many tests the problem is most likely due to the fact that Git is not made to handle many large files and therefore putting the whole project in the repository is not a good method. It's the Unity packages that are causing the problem.

I would have to master more how Git works to have a more targeted and granular use of it to put only what is useful to me and I would do it another time.

Thank you all for your help, it will at least have given me some knowledge and the start of a better understanding of Git and SSH.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM