【问题标题】:Git push origin master -f : "fatal 'origin' does not appear to be a git repository - fatal Could not read from remote repository."Git push origin master -f:“致命的'origin'似乎不是git存储库-致命的无法从远程存储库中读取。”
【发布时间】:2020-01-20 00:59:22
【问题描述】:

我知道我的问题看起来与某些问题相似,但我认为我的问题可能是新问题。

$ git init  #  Make a new repository
$ git add -A   # Add all the files which have not been added
$ git commit -m "Initialize repository"  
$ git push origin master -f

我的问题是,当我命令git push origin master -f 时,它显示了这个错误:

fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

你能给我一些想法吗?

【问题讨论】:

标签: git


【解决方案1】:

您似乎没有将本地指向任何远程分支。 通过以下命令检查您的遥控器:

git remote -v

你会看到这样的:

origin http:link_to_your_repo/repo_name.git (fetch)
origin http:link_to_your_repo/repo_name.git (push)

如果此命令失败,则意味着您必须添加远程源(我假设这是您的情况)。 如果没有远程分支,则创建一个。现在指向你本地的这个远程分支。

`git remote add origin git@github.com:user/your_remote_repo.git` //***[you will get this link when you create one]***

现在推送您的更改:

git push origin master

这应该可行。

【讨论】:

    猜你喜欢
    • 2015-11-21
    • 2023-04-05
    • 2012-06-09
    • 2020-06-10
    • 2015-07-01
    • 1970-01-01
    • 2022-10-23
    • 2019-10-24
    • 2012-11-10
    相关资源
    最近更新 更多