Why call git branch --unset-upstream to fixup?

后端 未结 8 1396
夕颜
夕颜 2020-12-12 09:42

I\'m more of a novice when it comes to advanced operations in git. I maintain my blog using the blogging framework Octopress. Though Octopress is not under any development s

8条回答
  •  忘掉有多难
    2020-12-12 10:33

    Actually torek told you already how to use the tools much better than I would be able to do. However, in this case I think it is important to point out something peculiar if you follow the guidelines at http://octopress.org/docs/deploying/github/. Namely, you will have multiple github repositories in your setup. First of all the one with all the source code for your website in say the directory $WEBSITE, and then the one with only the static generated files residing in $WEBSITE/_deploy. The funny thing of the setup is that there is a .gitignore file in the $WEBSITE directory so that this setup actually works.

    Enough introduction. In this case the error might also come from the repository in _deploy.

    cd _deploy
    
    git branch -a
    * master
    remotes/origin/master
    remotes/origin/source
    

    In .git/config you will normally need to find something like this:

    [core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
    [remote "origin"]
        url = git@github.com:yourname/yourname.github.io.git
        fetch = +refs/heads/*:refs/remotes/origin/*
    [branch "master"]
        remote = origin
        merge = refs/heads/master
    

    But in your case the branch master does not have a remote.

    [core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
    [remote "origin"]
        url = git@github.com:yourname/yourname.github.io.git
        fetch = +refs/heads/*:refs/remotes/origin/*
    

    Which you can solve by:

    cd _deploy
    git branch --set-upstream-to=origin/master
    

    So, everything is as torek told you, but it might be important to point out that this very well might concern the _deploy directory rather than the root of your website.

    PS: It might be worth to use a shell such as zsh with a git plugin to not be bitten by this thing in the future. It will immediately show that _deploy concerns a different repository.

提交回复
热议问题