Step 1: Backup your project
Before proceeding, make sure you have a backup of your project files in case anything goes wrong.
Step 2: Delete the local Git repository
- Open your terminal or command prompt.
- Navigate to your project directory using the
- Remove the
.gitfolder by running:
rm -rf .git
This command will delete the hidden
.git directory which contains all the version control information.
After removing Git, you can now upload your project to a new repository.
Step 1: Initialize a new Git repository
- Create a new empty repository on your preferred Git hosting service (GitHub, GitLab, Bitbucket, etc.).
- In your terminal, navigate to your project directory.
- Initialize a new Git repository:
Step 2: Add your files and commit
- Add all your project files to the new repository:
git add .
- Commit the files:
git commit -m "Initial commit"
Step 3: Link the local repository to the remote one
- Link your local repository to the new remote repository:
git remote add origin <new_repository_URL>
<new_repository_URL> with the URL of your new repository.
- Push your code to the new remote repository:
git push -u origin master
This will push your code to the new repository's
master branch. If you have a different branch name, replace
master with your branch name.
Remember to substitute
<new_repository_URL> with the actual URL of your new repository.
These steps will create a new Git repository for your project and upload the files to the remote repository.