Git commit ERROR: Repository invalid

2019-09-12 06:00发布

I recently came across the octopress blogging platform and followed the installation instructions. I am hosting it on github using github pages. I created a repository and successfully managed to make an initial commit. My problem came when I tried to make another commit and this is the message I got:

Immanuels-MacBook-Pro:octopress manuweg$ git add .
Immanuels-MacBook-Pro:octopress manuweg$ git commit -m "Changed origin url"
[source e0fff54] Changed origin url
1 files changed, 1 insertions(+), 1 deletions(-)
Immanuels-MacBook-Pro:octopress manuweg$ git push origin source
ERROR: Repository invalid.
fatal: The remote end hung up unexpectedly

This is the config in my .git/config file

[remote "origin"]
    url = git@github.com:manuweg/manuweg.github.com.git
    fetch = +refs/heads/*:refs/remotes/origin/*

When I do

git config --get-regexp '^(remote|branch)\.'

I get

remote.octopress.url git://github.com/imathis/octopress.git
remote.octopress.fetch +refs/heads/*:refs/remotes/octopress/*
branch.source.remote origin
branch.source.merge refs/heads/master
remote.origin.url git@github.com:manuweg/manuweg.github.com.git
emote.origin.fetch +refs/heads/*:refs/remotes/origin/*

As you can see there seems to be a spelling mistake on the last line

emote.origin.fetch +refs/heads/*:refs/remotes/origin/*

Which I assume should read:

remote.origin.fetch +refs/heads/*:refs/remotes/origin/*

The remote origin url is correct and worked for the initial commit. Any ideas why I am getting this error?

3条回答
甜甜的少女心
2楼-- · 2019-09-12 06:37

In http://octopress.org/docs/deploying/github/

Use this if you want to host a blog from http://username.github.com (though you can also use custom domains).

Create a new Github repository and name the repository with your user name or organization name username.github.com or organization.github.com.

repo name should be username.github.com, not username.

查看更多
家丑人穷心不美
3楼-- · 2019-09-12 06:47

So I solved this problem by creating another origin with exactly the same details as the first origin:

git remote add origin2 git@github.com:manuweg/manuweg.github.com.git
查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-09-12 06:56

I solved the error by deleting the origin and re-adding it. hope this helps. you should replace and with your information.

git remote rm origin
git remote add origin git@github.com:<username>/<applicationname>.git
查看更多
登录 后发表回答