The step-by-step procedure to clone a GitHub repository and push all the commits with your name and email:
Clone the Forked Repository:
- Copy the URL of your forked repository (HTTPS or SSH).
- Open your terminal or command prompt.
- Navigate to the directory where you want to clone the repository.
- Run the following command, replacing
<forked-repository-url>
with the copied URL:git clone <forked-repository-url>
Change into the Cloned Repository's Directory:
- Run the following command, replacing
<forked-repository-name>
with the name of the cloned repository's directory:cd <forked-repository-name>
- Run the following command, replacing
Configure Git User Information:
- Set your name and email for the commits. Replace
<Your Name>
and<your-email@example.com>
with your desired name and email address, respectively:git config user.name "<Your Name>" git config user.email "<your-email@example.com>"
- Set your name and email for the commits. Replace
Replace Commits with Updated Name and Email:
- Run the following command to rewrite all the commits in the repository with your name and email:
git filter-branch -f --env-filter ' export GIT_AUTHOR_NAME="<Your Name>" export GIT_AUTHOR_EMAIL="<your-email@example.com>" export GIT_COMMITTER_NAME="<Your Name>" export GIT_COMMITTER_EMAIL="<your-email@example.com>" ' --tag-name-filter cat -- --branches --tags
- Run the following command to rewrite all the commits in the repository with your name and email:
Create a New Repository on GitHub:
- Go to GitHub and create a new repository where you want to push the updated commits.
Change the Remote URL:
- Add the New Remote URL:
- Open your terminal or command prompt.
- Navigate to the directory of your cloned repository.
- Run the following command, replacing
<new-repository-url>
with the copied URL:git remote add new-origin <new-repository-url>
- Add the New Remote URL:
Force-Push the Changes:
- Before force-pushing, ensure you have a backup or are certain that you want to replace the entire commit history.
- Run the following command to force-push the rewritten commits to the new repository:
git push --force new-origin --all
By following these steps, you will successfully clone the repository, rewrite the commits with your name and email, and push them to a new repository with the updated author information.
Please let me know if you need any further assistance.