如何成功重命名存储库而不会出现多个错误?

时间:2018-04-20 16:24:43

标签: github github-pages

我重命名了一个存储库,并尝试按照帮助页面上的步骤操作,但正如您在图像中看到的那样,旧名称显然仍处于活动状态并且导致我出错:

  1. 重命名网址
  2. 添加已经存在的新网址
  3. 尝试推送更改,但未找到""
  4. 它怎么能给我'#34;未找到"的状态?并且已经存在"对于具有相同URL的同一存储库?

    如果有人能够对此事有所了解,我将不胜感激:

     Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git checkout -- <file>..." to discard changes in working directory)
    
            modified:   _casestudies/case-one.html
    
    no changes added to commit (use "git add" and/or "git commit -a")
    
    HP@carlas MINGW64 ~/Documents/Wed Development/portfolio (gh-pages)
    $ git add .
    
    HP@carlas MINGW64 ~/Documents/Wed Development/portfolio (gh-pages)
    $ git remote -v
    github  https://carlashub.github.io/carlashub/ (fetch)
    github  https://carlashub.github.io/carlashub/ (push)
    origin  https://carlashub.github.io/carla/ (fetch)
    origin  https://carlashub.github.io/carla/ (push)
    
    HP@carlas MINGW64 ~/Documents/Wed Development/portfolio (gh-pages)
    $ git commit -m "removed broken link"
    [gh-pages 19bf5a1] removed broken link
     1 file changed, 1 insertion(+), 1 deletion(-)
    
     ~/Documents/Wed Development/portfolio (gh-pages)
    $ git push -u origin gh-pages
    fatal: repository 'https://carlashub.github.io/carla/' not found
    
    HP@carlas MINGW64 ~/Documents/Wed Development/portfolio (gh-pages)
    $ git remote add origin https://github.com/CarlasHub/carla.git
    fatal: remote origin already exists.
    
    HP@carlas MINGW64 ~/Documents/Wed Development/portfolio (gh-pages)
    $ git push -u origin gh-pages
    fatal: repository 'https://carlashub.github.io/carla/' not found
    

1 个答案:

答案 0 :(得分:3)

我解决了网址误解。

正如Chris上面提到的,我将页面网址存储库网址混淆,并感谢您指出这一点。我想主要的问题是两者的类似命名,我将来会避免的。

我试图推送到GitHub页面网址:

https://carlashub.github.io/carla/

我需要通过此URL推送到GitHub存储库:

https://github.com/CarlasHub/carla

我通过运行此命令修复此问题:

git remote set-url origin https://github.com/CarlasHub/carla

之后,再次执行推送:

git push -u origin gh-pages

现在一切正常。