fatal: 'origin' does not appear to be a git repository

Problem

I’ve a repository moodle on my Github account which I forked from the official repository.

I then cloned it on my local machine. It worked fine. I created several branches (under the master branch). I made several commits and it worked fine.

I don’t know how I’m getting the following error when I do : git push origin master

fatal: ‘origin’ does not appear to be a git repository
fatal: The remote end hung up unexpectedly
How do I resolve the error without effecting my repository on Github?

The contents of my .git/config after doing cat $(git rev-parse --show-toplevel)/.git/config gives:

[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[branch “master”]
[branch “MOODLE_23_STABLE”]
[branch “MOODLE_24_STABLE”]
[remote “upstream”]
url = git://git.moodle.org/moodle.git
fetch = +refs/heads/:refs/remotes/upstream/

Solution

$HOME/.gitconfig is your global config for git.
There are three levels of config files.

cat $(git rev-parse --show-toplevel)/.git/config
(mentioned by bereal) is your local config, local to the repo you have cloned.

you can also type from within your repo:

git remote -v
And see if there is any remote named ‘origin’ listed in it.

If not, if that remote (which is created by default when cloning a repo) is missing, you can add it again:

git remote add origin url/to/your/fork
The OP mentions:

Doing git remote -v gives:

upstream git://git.moodle.org/moodle.git (fetch)
upstream git://git.moodle.org/moodle.git (push)
So ‘origin’ is missing: the reference to your fork.
See “What is the difference between origin and upstream in github”

enter image description here
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值