Reputation: 876
I cloned one open source project. Now, since I would like to backup that and show it to some people, I would like it to push it to my github account. The issue is that the original repo is now changed, it has a lot of commits added after I originally pulled it, and I don't really want those as I haven't tested them with my modifications.
I tried forking that repo from github to my account, but couldn't merge this one due to many changes present there. (I see the files with git status command) Also, I tried creating a new empty repo and tried to commit changes from that code to that new repo (I edited some of the config files to point to that one, (similar to git remote), but still I didn't manage to succeed.
Can anyone provide me with a method which will allow me to push this code I have to my github account, creating a new repo (or inserting it into the new one), without losing the changes or pulling the new commits from the original repo?
Thanks!
Upvotes: 1
Views: 1595
Reputation: 876
So, I did these steps do fix the issue:
git init
commandgit add *
commandgit remote add origin path/to/.git/online
git commit -m 'blabla'
to make the initial commitgit push origin master
to push it to the repoThis solved my issue!
Upvotes: 2
Reputation:
If you forked the project on github and checked out your fork, it is safe to push the changes to the your repo (it will not affect the original project). Just make sure the origin
url is pointing to your fork (and not the original).
You can establish the url by running this command:
git remote show origin
I wouldn't worry though because if you have no permissions to push to the original project, you will not commit your changes.
It is pointless to create a new project (licenses withstanding), you can do what you want with-in the git workflow (and subsequently github).
Upvotes: 2