git Git推送到本地存储库

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

Git push to local repository

gitrepositorypush

提问by user14416

I make two repositories on my machine, I follow this guide. And in the last step I get this error:

我在我的机器上创建了两个存储库,我遵循了这个指南。在最后一步中,我收到此错误:

elta compression using up to 2 threads.
error: inflate: data stream error (incorrect data check)
error: corrupt loose object '6dcf134fd4eb663f01bc1088b12f7cf389254636'
fatal: loose object 6dcf134fd4eb663f01bc1088b12f7cf389254636 (stored in .git/objects/6d/cf134fd4eb663f01bc1088b12f7cf389254636) is corrupt
error: failed to push some refs to 

I removed and create repository from the beginning several times, but it did not help.

我从一开始多次删除并创建存储库,但没有帮助。

采纳答案by Daniel Haro

I use github also, but in windows. I had 2 major problems while pushing at least till I found my problem. Try looking at both of theses solutions

我也使用 github,但在 Windows 中。至少在我发现问题之前,我遇到了两个主要问题。尝试查看这两个解决方案

  1. The URL is case sensitive. So make sure your remote's url is exactly correct including (upper/lower case letters).

  2. For some reason (never bother to figure out why) you may also need to pull from github before pushing. To this date I have had to do this for every project (at least before the first push).

  1. URL 区分大小写。因此,请确保您的遥控器的 url 完全正确,包括(大写/小写字母)。

  2. 出于某种原因(不要费心去弄清楚原因),您可能还需要在推送之前从 github 中拉取。到目前为止,我不得不为每个项目都这样做(至少在第一次推送之前)。

So:

所以:

git pull <remote name> <branch name>
git push <remote name> <branch name>

Most likly in your case:

最有可能在您的情况下:

remote name = origin
branch name = master

And just to itterate the entire process. Did you do all theses steps:

并且只是为了迭代整个过程。你做了所有这些步骤:

git init 
git add .
git commit -m "inital commit"
git remote add <device name> URL
git pull <device Name> master
git push <decive Name> master

Also note that many of the git walkthroughs try to get fancy with the remotes. I would go to the very basics at least until you get that working. So to beat a dead horse!

另请注意,许多 git 演练都试图对遥控器感兴趣。至少在你开始工作之前,我会去了解最基本的东西。所以要打败死马!

git remote add origin https://github.com/<account name>/<repo name>.git

Or in my case it would look like this:

或者就我而言,它看起来像这样:

git remote add origin https://github.com/DanielHaro/my_app.git

but I hate the remote name origin so I actually use:

但我讨厌远程名称来源,所以我实际上使用:

git remote add tron https://github.com/DanielHaro/my_app.git

Which is so cute becase later you get to use:

这很可爱,因为以后你会使用:

git push tron master