简体   繁体   English

Git推送不起作用,但“ git clone”和SSH可以

[英]Git push not working but “git clone” and SSH does

I set up a Debian server that uses SSH for shell access and git repos. 我设置了一个使用SSH进行外壳访问和git repos的Debian服务器。 I created a bare repo on it and using ssh was able to clone it to my Windows 8 workstation, however when trying to push changes back to the Debian server I get the error depicted here: 我在上面创建了一个裸仓库,并使用ssh将其克隆到了Windows 8工作站,但是当尝试将更改推回Debian服务器时,出现了以下错误:

在此处输入图片说明

Read from remote host 174.52.5.192: Connection reset by peer
fatal: sha1 file '<stdout>' write error: invalid argument
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'git@174.52.5.192:/home/git/repos/space-junk.git/'

I use this work station regularly for shell access to the same server via SSH so I know inability to access SSH isn't the problem. 我定期使用此工作站通过SSH通过Shell访问同一服务器,因此我知道无法访问SSH并不是问题。

Does anyone have any idea what's going wrong? 有谁知道发生了什么事吗?

Actually, the first push should be: 实际上,第一步应该是:

git push -u origin master

That will link the local branch master to its remote tracking one origin/master 这会将本地分支主机链接到其远程跟踪一个源/主机

Then, after that first push, you will be able (for all the subsequent push) to do a simple: 然后,在第一次推送之后,您将能够(对于所有后续推送)执行简单的操作:

git push

See more at " Why do I need to explicitly push a new branch? ". 有关更多信息,请参见“ 为什么需要显式推送新分支? ”。

I got it working! 我知道了! It turns out the proper command was 原来正确的命令是

git push origin master

The Windows version didn't have a descriptive enough error message but I got it working by switching over to Linux, which told me my command was wrong. Windows版本没有足够描述性的错误消息,但是我通过切换到Linux使其工作,这告诉我我的命令是错误的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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