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

后端 未结 13 1242
醉话见心
醉话见心 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条回答
  • 2020-11-29 00:34

    Your config file does not include any references to "origin" remote. That section looks like this:

    [remote "origin"]
        url = git@foo.com:repository.git
        fetch = +refs/heads/*:refs/remotes/origin/*
    

    You need to add the remote using git remote add before you can use it.

    0 讨论(0)
  • 2020-11-29 00:35

    Here are the instructions from github:

    touch README.md
    git init
    git add README.md
    git commit -m "first commit"
    git remote add origin https://github.com/tqisjim/google-oauth.git
    git push -u origin master
    

    Here's what actually worked:

    touch README.md
    git init
    git add README.md
    git commit -m "first commit"
    git remote add origin https://github.com/tqisjim/google-oauth.git
    git clone origin master
    

    After cloning, then the push command succeeds by prompting for a username and password

    0 讨论(0)
  • 2020-11-29 00:36

    Here is how I resolved this issue

    Go to the remote repository on Github and copy the project's repository url.

    On git bash type: git remote add origin the remote repository url goes here

    0 讨论(0)
  • 2020-11-29 00:38

    I had this problem cause i had already origin remote defined locally. So just change "origin" into another name:

    git remote add originNew https://github.com/UAwebM...

    git push -u originNew

    or u can remove your local origin. to check your remote name type:

    git remote

    to remove remote - log in your clone repository and type:

    git remote remove origin(depending on your remote's name)

    0 讨论(0)
  • 2020-11-29 00:39

    When you create a repository in bitbucket.org, it gives you instructions on how to set up your local directory. Chances are, you just forgot to run the code:

    git remote add origin https://username@bitbucket.org/username/reponame.git

    0 讨论(0)
  • 2020-11-29 00:39

    If you are on HTTPS do this-

    git remote add origin URL_TO_YOUR_REPO
    
    0 讨论(0)
提交回复
热议问题