【发布时间】:2014-02-01 08:50:14
【问题描述】:
我必须承认,我对初始化 Git 完全感到困惑——尽管这并不是第一次。
我首先下载了原始 Git bash 并在C:\xampp\htdocs\something 创建了一个存储库something。同时,我在我的个人资料下创建了 something 存储库。我当时认为他们可能会联系在一起(在我登录后)——这种天真很快就会受到惩罚。
然后我意识到这个 Git bash 真的不喜欢我,所以我下载了标准的“Git for windows”。
我删除了C:\xampp\htdocs\something中的.git,我删除了存储库的在线版本。我还查看了 Documents\GitHub\ 的 something 文件夹,但它不存在。
但是,听起来我删除的不够多 - 看看:
那么 Git 还会在哪里存储有关现有存储库的数据呢?我会因此而不得不选择不同的名字吗?
我可以列出存储库以了解它发生的原因吗?
通过控制台初始化 repo(成功)
可能的解决方法是使用 Git shell 控制台:
cd C:\xampp\htdocs\somethinggit initInitialized empty Git repository in C:/xampp/htdocs/rimedit/.git/
使用 GUI 应用推送(失败)
但是使用控制台是一种解决方法,而不是答案。此外,我仍然无法推动:
用控制台推送(也失败了)
为了尽可能让我生气,这是控制台在推送时抛出的内容:
remote: Repository not found.
fatal: repository 'https://github.com/Darker/rimedit.git/' not found
请注意,该错误与我在 GUI 应用程序中遇到的错误完全相反。
删除缓存
Git 将一些缓存数据和帐户信息存储在 %APPDATA%\GitHub\ (thanks Chris)。删除缓存并没有解决问题 - 似乎它可能是服务器端的。
终于有一个解决方案(不是答案)
控制台中的 Repository not found. 通过再次在服务器上创建存储库来简单地修复。在此之后,我会得到这个推送:
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/Darker/rimedit.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
所以我想拉,但又报错:
* [new branch] master -> git/master
You asked to pull from the remote 'git', but did not specify
a branch. Because this is not the default configured remote
所以,毕竟我找到了this post。我将配置编辑为如下所示:
[remote "git"]
url = https://github.com/<account name>/<repo name>.git
fetch = +refs/heads/*:refs/remotes/git/*
[branch "master"]
remote = git
merge = refs/heads/master
在此之后,我只需要pull readme.md 然后push 我的所有数据。
【问题讨论】:
-
我也怀疑服务器有问题。此时你可能想contact GitHub support。
-
我确实联系过他们。我已经在等回复了。我与他们联系了一段时间 - 但他们不确定任何事情,所以这可能是一个错误。
git init解决方案来自 github 支持。