我有这种情况:
$ 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] 删除。
我来说两句