从git remote push URL中删除错误编写的URL

汉斯

我有这种情况:

$ git remote show origin
* remote origin
  Fetch URL: [email protected]:/gruprog-20/hansji-p-uppgift.git
  Push  URL: https://github.com/kulkarninomizuproduct/p-uppgift.git
  Push  URL: ^C
  Push  URL: ^C
  Push  URL: [email protected]:/gruprog-20/hansji-p-uppgift.git
  HEAD branch: master
  Remote branch:
    master tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (fast-forwardable)

当我尝试复制某些内容时发生了这种情况,当我按ctrl + C时,“ ^ C”被意外地作为推送URL添加到了我的远程服务器“ origin”中(尽管我从未按过enter)。我尝试了许多不同的命令将其删除:

$ git remote remove ^C
$ git remote rm ^C
$ git remote rm url ^C
$ git remote set-url --delete --push ^C
$ git remote set-url --delete ^C
$ git remote set-url --delete --push <^C>
$ git remote set-url --delete --push origin ^C

我怀疑该URL实际上不是“ ^ C”,而是实际命令ctrl + C,因为看一下这种区别:

#When I write "git remote rm", then ctrl+C (as above, I dont need to press enter)(it returns nothing):

$ git remote rm ^C


# When I write "git remote ^C"

$ git remote rm ^C
fatal: No such remote: '^C'
稳定网

您需要指定要删除的遥控器,因此origin在这种情况下,如下所示:

git remote remove origin

您还可以使用set-url更改远程URL(更改实际来源git / https URL的URL):

git remote set-url origin URL

如果这两个都不适合您,则可以从项目的根目录手动编辑以下文件:

.git/config

内容应如下所示:

[remote "origin"]
        url = ...
        fetch = +refs/heads/*:refs/remotes/origin/*

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Git push not showing new branch on remote

什么是“ git remote add ...”和“ git push origin master”?

“ git push”似乎已替换为“ git remote-Z”

无法删除git remote

为什么全局git配置“ remote.origin.push”会覆盖本地的“ remote.origin.push”?

“为‘git push’配置的本地引用:”列在‘git remote show origin’的输出中是什么意思?

卡在git push中

git push->代码仅查看当前更改(remote.origin.push覆盖push.default)

How to change the URI (URL) for a remote Git repository?

如何删除git remote show中的内容?

使用预设的repo URL执行git push

从git push远程响应中提取URL

BASH中的Git Push脚本

了解“ git remote show”命令输出...的含义是:“为'git push'配置了本地引用”?

远程git push中的致命错误

Git Push rubyrails中的Heroku Master错误

git push origin HEAD : remote_branch 和 git push origin local_branch:remote_branch 有什么区别?

git push --mirror和git set-url之间的区别

如何从 .git 中完全删除错误暂存的大文件?

“ git fetch <url>”和“ git add remote remote <url>”后跟“ git fetch上行”有什么区别?

除非详细说明,否则使用ssh remote进行git push失败

git remote add引发致命错误

通过“ git push”中的“ --push-option =“发送多个选项

Git Push使用了错误的凭证

centos6上的git push错误

$ git push cloud致命:远程错误:禁止

我执行git push时发生错误

Git Push错误预接收挂钩被拒绝

Git Push错误:拒绝更新签出的分支