简体   繁体   English

Git推送到本地存储库

[英]Git push to local repository

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. 我从一开始就删除并创建了存储库几次,但这没有帮助。

I use github also, but in windows. 我也使用github,但在Windows中。 I had 2 major problems while pushing at least till I found my problem. 在至少推到发现问题之前,我遇到了2个主要问题。 Try looking at both of theses solutions 尝试看看这两种解决方案

  1. The URL is case sensitive. 该网址区分大小写。 So make sure your remote's url is exactly correct including (upper/lower case letters). 因此,请确保您的遥控器的URL完全正确,包括(大写/小写字母)。

  2. For some reason (never bother to figure out why) you may also need to pull from github before pushing. 由于某些原因(永远不要弄清楚为什么),您可能还需要在推送之前从github中拉出。 To this date I have had to do this for every project (at least before the first push). 到目前为止,我必须对每个项目都这样做(至少在第一次推送之前)。

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. 还要注意,许多git演练都试图使遥控器看起来不错。 I would go to the very basics at least until you get that working. 至少在您开始工作之前,我会讲一些基础知识。 So to beat a dead horse! 所以要打死马!

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

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

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