Git commit ERROR: Repository invalid

一个人想着一个人 提交于 2020-01-06 14:50:07

问题


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?


回答1:


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



回答2:


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



回答3:


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.



来源:https://stackoverflow.com/questions/11240797/git-commit-error-repository-invalid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!