Clone someone else's repo into your own Github? #118468
Replies: 2 comments
-
Hi! Remove the .git folder: Navigate to the cloned repository's root directory and remove the .git folder. This action converts it into a non-Git directory, allowing you to add it to another repository. Use the command rm -rf .git in the terminal within the directory. This makes Git treat the folder like regular files. Reinitialize Git (Optional): If you need to retain the commit history of the cloned repo in your personal repo, instead of removing the .git folder, you can push the cloned repo as a branch to your repository. Then, you can merge it with your work as needed. Add, Commit, And Push: After removing the .git folder (or merging branches if you chose to retain history), you can then git add ., git commit -m "Your message", and git push to your personal repository on GitHub. Remember, if you remove the .git directory, you'll lose the commit history of the cloned repository. If maintaining this history is important, consider the alternative approach of merging histories or using submodules if you frequently need to work with external repositories. |
Beta Was this translation helpful? Give feedback.
-
Welcome to the GitHub Community, @Lupitaqs , we're happy you're here! You are more likely to get a useful response if you are posting your question(s) in the applicable category and are explicit about what your project entails--giving a few more details might help someone give you a nudge in the right direction. I've gone ahead and moved it for you. Good luck! |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
Context: I created a new repo inside my Github account on the internet
Goal: Clone some random repo into my VSCode (yes, I know the
git clone
) so then I could push it into my personal repo inside my GithubProblem: When I try to
git add .
the console displays a long message mentioning the files inside won't be added because they refer to another repoHow can I solve this problem?
I'm taking a course to learn backend, and I needed those frontend files (the ones I need to clone) to build the backend, however I wanted to keep my project inside Github to be able to look at the commits so whenever I wanna review how I did something I could look at those!
Any solutions?
I already tried all solutions from https://stackoverflow.com/questions/18200248/cloning-a-repo-from-someone-elses-github-and-pushing-it-to-a-repo-on-my-github but none of them worked for me, some push the folder but empty (since didn't grant the permissions and the folder appears in blue colour)
Help 😟
Beta Was this translation helpful? Give feedback.
All reactions