Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.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存储库,除了我克隆了公共repo URL,而不是私有URL_Git_Github - Fatal编程技术网

使用分叉git存储库,除了我克隆了公共repo URL,而不是私有URL

使用分叉git存储库,除了我克隆了公共repo URL,而不是私有URL,git,github,Git,Github,git新手,所以希望这是一个简单的问题,有一个简单的答案 我在GitHub上建立了一个存储库。然后,我使用公共repo URL在本地机器上克隆了它:git@github.com:samuelclay/django mingus.git,与私有回购URL相反:git://github.com/samuelclay/django-mingus.git 我对代码做了一些更改,并提交了这些更改,为了将我的更改推进到我的forked repo,我发布了:git remote add upstreamgit

git新手,所以希望这是一个简单的问题,有一个简单的答案

我在GitHub上建立了一个存储库。然后,我使用公共repo URL在本地机器上克隆了它:
git@github.com:samuelclay/django mingus.git
,与私有回购URL相反:
git://github.com/samuelclay/django-mingus.git

我对代码做了一些更改,并提交了这些更改,为了将我的更改推进到我的forked repo,我发布了:
git remote add upstreamgit://github.com/samuelclay/django-mingus.git
,然后
git向上游推送
,但这并没有给我一个错误(它说的一切都是最新的),它当然不会将我的更改推到GitHub上


有没有办法更改为私有回购URL?这是必要的吗?

您已将公共和私有URL向后设置。
git://
URL是公共的;
git@github
URL是私有的


如果您想更改repo URL,只需在文本编辑器中打开
.git/config
文件,找到有问题的URL,然后将其更改为另一个。查看文档以了解有关配置文件格式的更多信息。

我可以通过编辑.git/config文件轻松做到这一点

$git clone git://github.com/user/test.git # Clone from read only # Make changes $ git push fatal: remote error: You can't push to git://github.com/user/test.git Use git@github.com:user/test.git $git推送 计数对象:5,完成。 增量压缩最多使用2个线程。 压缩对象:100%(3/3),完成。 写入对象:100%(3/3),298字节,完成。 总计3(增量2),重复使用0(增量0) 到git@github.com:user/test.git 58986b8..c8bd8c2主控->主控 成功

[remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* # Remove this line: #url = git://github.com/user/test.git # Add this line: url = git@github.com:user/test.git [branch "master"] remote = origin merge = refs/heads/master $ git push Counting objects: 5, done. Delta compression using up to 2 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 298 bytes, done. Total 3 (delta 2), reused 0 (delta 0) To git@github.com:user/test.git 58986b8..c8bd8c2 master -> master