New to git, so this is hopefully a simple question with a simple answer.
I forked a repository on GitHub. I then cloned it on my local machine by using the public repo URL: [email protected]:samuelclay/django-mingus.git
, as opposed to the private repo URL: git://github.com/samuelclay/django-mingus.git
.
I made some changes to the code, committed those changes, and in order to push my changes up to my forked repo, I issued: git remote add upstream git://github.com/samuelclay/django-mingus.git
, and then git push upstream
, but while that doesn't give me an error (it says Everything up-to-date), it is certainly not pushing my changes up to GitHub.
Is there a way to change to the private repo URL? Is that even necessary?
You can make a local copy of your forked repository on your computer with the git clone command. Data Tip: You can also copy the URL directly from your web browser, or in some cases, you might already know the URL.
Just go to https://github.com/new/import . In the section "Your old repository's clone URL" paste the repo URL you want and in "Privacy" select Private .
Forks of public repositories are public, and forks of private ones are private. Removing access to a private repository deletes that person's fork. Deleting a private repository deletes all forks of it, which are also private. If you wish to keep a copy, you have to clone and publish it yourself.
The quick answer Forking creates your own copy of a repository in a remote location (for example, GitHub). Your own copy means that you will be able to contribute changes to your copy of the repository without affecting the original repository. Cloning makes a local copy of a repository, not your own copy.
I was able to easily do this by editing the .git/config file.
$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 [email protected]:user/test.git
So I edited .git/config
for that project and changed the origin's url:
[remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* # Remove this line: #url = git://github.com/user/test.git # Add this line: url = [email protected]: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 [email protected]:user/test.git 58986b8..c8bd8c2 master -> master
Success!
You've gotten the public and private URLs backwards. The git://
URL is the public one; the git@github
URL is the private one.
If you want to change a repo URL, just open up your .git/config
file in a text editor, find the offending URL, and change it to the other one. Check the git config
documentation for more information on the format of the config file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With