git是新手,所以希望这是一个简单的答案简单的问题.
我在GitHub上分叉了一个存储库.然后我使用公共repo URL在本地计算机上克隆它:git@github.com:samuelclay/django-mingus.git
而不是私有repo URL : git://github.com/samuelclay/django-mingus.git
.
我对代码进行了一些更改,提交了这些更改,并且为了将我的更改推送到我的分支仓库,我发布了:git remote add upstream git://github.com/samuelclay/django-mingus.git
然后git push upstream
,虽然这不会给我一个错误(它说的一切都达到了 -日期),肯定不会将我的更改推向GitHub.
有没有办法更改为私人repo 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/config
为该项目编辑并更改了原始的url:
[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
成功!