Github :似乎不是 git 存储库

Github : Does not appear to be a git repository

我需要为我自己的 github 帐户创建一个新的遥控器。但是当我尝试输入下面的代码时出现错误。

pushpika@pushpika-CodeMe MINGW32 ~/codezeroplus-1.0 (master)
$ git fetch pushpika@work 
fatal: 'pushpika@work' does not appear to be a git repository
fatal: Could not read from remote repository

Please make sure you have the correct access rights and the repository exists.

我现在需要做什么?

根据你的问题,我认为你需要重新开始。至少要确保你已经完成了先决条件。跟随,你将全部设置为 push , pull , branch , stash ....etc

首先进行初始设置以连接上游。

git config --global user.name "YOUR NAME"


git config --global user.email "YOUR EMAIL ADDRESS"

您可以在此处阅读更多内容 github DOC

.com 然后,您需要转到 gihub 并创建一个新的存储库。

创建新项目后,将有克隆URL。像这样的东西"you will need to link you local with the remote" :

git@github.com:mike/blah.git

在本地执行以下操作:

CD=> 导航到项目文件夹
和 运行 以下命令:

git init


git add .
# Adds the files in the local repository and stages 
#them for commit. To unstage a file, use 'git reset
#HEAD YOUR-FILE'.

git commit -m "First commit"
# Commits the tracked changes and prepares them to be pushed to a
#remote repository. To remove this commit and modify the file,
#use 'git reset --soft HEAD~1' and commit and add the file again.      


git remote add origin remote repository URL
# Sets the new remote



git push origin master
# pus to remote . 

还有其他方法 this.But ,目前这是最简单的方法,直到掌握 git 为止。 .

如果您尝试添加远程存储库,您需要先执行远程添加。命令的基本结构是:

git remote add [shortname] [url]

如果您已经完成了这一步,但您仍然 运行 遇到问题,您应该仔细检查您的提取中的 shortnameurl。使用 git remote -v 命令列出 Git 存储的短名称和 url 配对。例如,

$ git remote -v
origin  https://github.com/schacon/ticgit (fetch)
origin  https://github.com/schacon/ticgit (push)

有一个shorthand "origin"及其对应的URL用于push和fetch。

检查以确保您的 shorthand(我假设这就是您尝试使用 "pushpika@work" 的方式)配置正确 and/or 使用完整的 URL 访问您的存储库。

PS。 2.5 Git Basics - Working with Remotes 文档中有有用的说明。查看 "Adding Remote Repositories" 部分以获取更多信息。