Git push error: “origin does not appear to be a git repository”

后端 未结 13 1389
醉话见心
醉话见心 2020-11-29 00:28

I am following the instructions given here to create a Git repository. All went well until the last line:

$ git push -u origin master  
13条回答
  •  萌比男神i
    2020-11-29 00:43

    As it has already been mentioned in che's answer about adding the remote part, which I believe you are still missing.

    Regarding your edit for adding remote on your local USB drive. First of all you must have a 'bare repository' if you want your repository to be a shared repository i.e. to be able to push/pull/fetch/merge etc..

    To create a bare/shared repository, go to your desired location. In your case:

    $ cd /Volumes/500gb/   
    $ git init --bare myproject.git
    

    See here for more info on creating bare repository

    Once you have a bare repository set up in your desired location you can now add it to your working copy as a remote.

    $ git remote add origin /Volumes/500gb/myproject.git
    

    And now you can push your changes to your repository

    $ git push origin master
    

提交回复
热议问题