我刚刚做了git init初始化我的文件夹作为git存储库,然后使用git remote add origin URL添加了一个远程存储库。现在我想删除这个git remote add origin,并添加一个新的仓库git remote add origin new- url。我该怎么做呢?


当前回答

使用实例移除遥控器。

git remote remove origin

添加遥控器。

git remote add origin yourRemoteUrl

最后

git push -u origin master

其他回答

您可以进入。git文件夹,无需使用命令即可编辑配置文件。

Well, This method and technique worked fine for me: 
Inside the .git folder of your project directory, change these files: 
1 -> configs file 
  -> open it up 
  -> change the ref URL to the remote one. 
 (You must also set your remote origin 
  branch the same as the local 
  branch here inside this file. e.g: remote: main, local: main
 ) 
2 -> git fetch 
3 -> .git 
  -> refs 
  -> heads && remotes folder 
  -> make sure both in files, origins are the same inside both heads and 
    remotes folders. e.g: main or master
4 -> .git 
  -> refs 
  -> remotes 
  -> main 
  -> open it up: 
   Copy the content and paste it inside the main file of the heads 
   folder.

Finally: 
Git fetch && git pull && git push 

使用实例移除遥控器。

git remote remove origin

添加遥控器。

git remote add origin yourRemoteUrl

最后

git push -u origin master

设置原点远程url-

   git remote set-url origin git://new.url.here

这里的origin是你的推送url名称。你可能有多个原点。如果你有多个原点,请将原点替换为那个名字。

删除Origin

   git remote rm origin/originName
   or
   git remote remove origin/originName

用于添加新的原点

   git remote add origin/originName git://new.url.here / RemoteUrl

要删除,只需使用此命令

git remote remove origin

添加新

git remote add origin (path)