Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
git推送源主机不工作_Git_Github - Fatal编程技术网

git推送源主机不工作

git推送源主机不工作,git,github,Git,Github,虽然,我可以在本地提交我的更改,但我不能推送到原始主机 我跑 我明白了 我跑 我明白了 这有什么问题?您的配置文件中似乎有一个不正确的origin条目 编辑存储库的.git/config文件以对其进行更改;格式相当简单,但如果您遇到问题,请发布其内容。2种方法 第一名:- git remote set-url <name> <newurl> 第二名:- git remote set-url <name> <newurl> 您需要做的是更改“

虽然,我可以在本地提交我的更改,但我不能推送到原始主机

我跑

我明白了

我跑

我明白了


这有什么问题?

您的配置文件中似乎有一个不正确的
origin
条目


编辑存储库的
.git/config
文件以对其进行更改;格式相当简单,但如果您遇到问题,请发布其内容。

2种方法 第一名:-

 git remote set-url <name> <newurl>
第二名:-

 git remote set-url <name> <newurl>
您需要做的是更改“origin”设置。您可以在项目根目录中编辑.git/config,它可能如下所示:

...
[remote "origin"]
url = git://user@dev.foo.com/git/repos/path
fetch = +refs/heads/*:refs/remotes/origin/*
...
或者,如果您的“远程”实际上是本地的:

...
[remote "origin"]
url = /path/to/repos/on/this/machine
fetch = +refs/heads/*:refs/remotes/origin/*
...

您所需要做的就是使用您最喜欢的编辑器编辑该文件,并将url=设置更改为新位置。假设新存储库设置正确并且URL正确,您将很高兴地在新的远程位置来回推送。

我知道这个问题比较老,但我在试图找到我遇到的错误的答案时遇到了它,并找到了答案。从2020年10月起,分支机构创建的任何新存储库都将被称为主存储库,而不是主存储库。GitHub正在重命名主分支,因为它具有主/从属性。您需要在main中键入git-push-orgin。

您可以使用
git-remote-v
查看当前定义的遥控器的值。这很奇怪。我在乞讨时也做了同样的事,但这次成功了。。无论如何谢谢你!
 git remote set-url <name> <newurl>
git remote set-url origin git@github.com:username/test.git
...
[remote "origin"]
url = git://user@dev.foo.com/git/repos/path
fetch = +refs/heads/*:refs/remotes/origin/*
...
...
[remote "origin"]
url = /path/to/repos/on/this/machine
fetch = +refs/heads/*:refs/remotes/origin/*
...