无法更改git远程原点 [英] Can't change git remote origin

查看:120
本文介绍了无法更改git远程原点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释为什么git remote origin不能从livepost.git更改为europeanexplorer.git吗?我试着按照指示,但文档指出错误:无法删除配置节'remote.origin'意味着该文件不存在,这显然不是这样在这里。

  $ git remote -v 
origin https://github.com/harrisongill/livepost.git(获取)
来源https://github.com/harrisongill/livepost.git(推)
$ git remote rm origin
错误:无法删除配置部分'remote.origin'
$ git remote set-url origin https://github.com/harrisongill/europeanexplorer.git
$ git remote -v
origin https://github.com/harrisongill/livepost.git(获取)
原点https://github.com/harrisongill/livepost.git(推送)
原点https://github.com/harrisongill/europeanexplorer.git(推送)
$ git远程RM源起
$ git远程-v
起源https://github.com/harrisongill/livepost.git(fetch)
起源https://github.com/harrisongill/livepost。 git(push)



编辑:添加git配置

  $ git config --list 
Harrisons -MacBook-Pro:欧洲资源管理器harrison $ git config --list
user.name = Harrison Gill
user.email =我的电子邮件
remote.origin.url = https:// github。 com / harrisongill / livepost.git
core.repositoryformatversion = 0
core.filemode = true
core.logallrefupdates = true
core.precomposeunicode = true


解决方案

所有命令行命令都将字符串写入 .git / code>目录。

Remotes在 .git / config 文件中很方便地配置,我认为这就是克里斯是指。



所以,如果你做 vim .git / config 你应该看到这样的内容:

  [core] 
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = false
[remoteorigin]
url = git@github.com:harrisongill / livepost.git
fetch = + refs / heads / *: refs / remotes / origin / *

以及其他可能混淆在 [remoteorigin] section:P.



为什么会搞砸?我不知道。然而,只是手动编辑这个文件应该让你直接:)



摆脱额外的东西,你应该很好去:)

Can someone explain why git remote origin cannot be changed from livepost.git to europeanexplorer.git? I tried following the directions, but documentation states that error: Could not remove config section 'remote.origin' means the file doesn't exist which clearly seems to not be the case here.

$ git remote -v
origin  https://github.com/harrisongill/livepost.git (fetch)
origin  https://github.com/harrisongill/livepost.git (push)
$ git remote rm origin
error: Could not remove config section 'remote.origin'
$ git remote set-url origin https://github.com/harrisongill/europeanexplorer.git
$ git remote -v
origin  https://github.com/harrisongill/livepost.git (fetch)
origin  https://github.com/harrisongill/livepost.git (push)
origin  https://github.com/harrisongill/europeanexplorer.git (push)
$ git remote rm origin
$ git remote -v
origin  https://github.com/harrisongill/livepost.git (fetch)
origin  https://github.com/harrisongill/livepost.git (push)

EDIT: Add git config

$git config --list
Harrisons-MacBook-Pro:European Explorer harrison$ git config --list
user.name=Harrison Gill
user.email=my email
remote.origin.url=https://github.com/harrisongill/livepost.git
core.repositoryformatversion=0
core.filemode=true
core.logallrefupdates=true
core.precomposeunicode=true

解决方案

All command line commands write strings into files in your .git/ directory.
Remotes are configured conveniently inside .git/config file, and I think that's what Chris was referring to.

So, if you do vim .git/config you should see something like this:

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

and perhaps something else that's confusing to git in the [remote "origin"] section :P.

Why did it get messed up? I don't know. However just manually editing this file should set you straight :)

Get rid of the extra stuff and you should be good to go :)

这篇关于无法更改git远程原点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆