git - 该目录似乎不是 git 存储库

标签 git github

我已将我的计算机恢复出厂设置,在此之前,我将我的 github 存储库从本地同步到远程。现在我试图添加一个本地存储库,它一直显示: This directory does not appear to be a git repository。所有存储库都这样做。我粘贴了 .gitattributes 文件,它们都在文件 github 中,并且创建了一个新的本地存储库。 GitHub Desktop not adding local repository

这是我为我拥有的一个在线存储库创建一个新存储库并尝试将它们与 URL 链接后的样子: Repository Settings not showing URL option

它没有显示 URL 选项。发布不起作用,因为它已经存在于 GitHub 上。

最佳答案

您不应添加现有文件夹,而应将您的存储库克隆到一个新文件夹,并从该新克隆开始工作。

参见 GitHub Desktop cloning a repository .

但是,如果您想将您的现有 文件夹用作现有远程仓库的本地仓库,请遵循 desktop/desktop issue 2883

  • Drag an ordinary folder into the app (or use Add Local Repository and choose the folder)
  • You'll get a message saying "This directory does not appear to be a Git repository. Would you like to create a repository here instead?" and the "Add Repository" folder is disabled
  • Click "create a repository here"
  • Select the "Repository -> Repository Settings... -> Remote" option. Enter the URL of your remote repo.

关于git - 该目录似乎不是 git 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51664169/

相关文章:

GitHub fork 以前提交的 repo

macos - 在私有(private)网络上使用 git 存储库设置 homebrew tap

git - 如何设置 ssh key 以绕过 git bash 密码提示

git merge "deleted by us"

git - 有没有办法将 git repo merge 到现有目录中?

GitHub:将问题评论移至不同的问题

git branch 列出上游的分支

macos - 如何让 git 在 OS X 上重置以前的凭据?

git - 显示本地(非跟踪)分支上未推送提交的数量

git checkout 失败,因为分支已经存在