Git push error '[remote rejected] master -> master (branch is currently checked out)'

前端 未结 30 2669
半阙折子戏
半阙折子戏 2020-11-22 00:07

Yesterday, I posted a question on how to clone a Git repository from one of my machines to another, How can I \'git clone\' from another machine?.

I am now

30条回答
  •  萌比男神i
    2020-11-22 00:37

    The best way to do this is:

    mkdir ..../remote
    cd ..../remote
    git clone --bare .../currentrepo/
    

    This will clone the repository, but it won't make any working copies in .../remote. If you look at the remote, you'll see one directory created, called currentrepo.git, which is probably what you want.

    Then from your local Git repository:

    git remote add remoterepo ..../remote/currentrepo.git
    

    After you make changes, you can:

    git push remoterepo master
    

提交回复
热议问题