Cannot remove remote origin

前端 未结 3 1396
你的背包
你的背包 2020-12-04 14:33

I\'m running git 1.8.0 on OS X, and every new git repo seems to have a remote called \"origin\":

$ git init
$ git remote
origin

What\'s odd

相关标签:
3条回答
  • 2020-12-04 14:55

    I solved my problems this way. First I opened up the config file using vim with the following command

    $ vim .git/config
    

    I modified my file to this below:

    [core]
            repositoryformatversion = 0
            filemode = true
            bare = false
            logallrefupdates = true
            ignorecase = true
            precomposeunicode = false
    [branch "master"]
    [remote "origin"]
            url = git@192.168.200.79:xxx.git
            fetch = +refs/heads/*:refs/remotes/origin_iOS/*
    

    So now, when I give a command git push it understands, because by default it pushed to origin and it is set to my origin_iOS in my server.

    You can check your origin config by remote -v command:

    $ git remote -v
    origin  git@192.168.200.79:xxxx.git (fetch)
    origin  git@192.168.200.79:xxx.git (push)
    

    If you don't have 'origin', you will have troubles with a usual 'git push' as I did. I had to type 'git push origin_iOS master', because I had in my config 'origin_iOS'

    0 讨论(0)
  • 2020-12-04 15:00

    Open the .git directory and edit the config file where it says [remote "origin"]

    0 讨论(0)
  • 2020-12-04 15:03

    You should be able to remove origin with

    git remote rm origin
    

    Not that you need to, you can just change the origin with set-url

    git remote set-url origin "https://..." 
    
    0 讨论(0)
提交回复
热议问题