I'm trying to share a project on GitHub and want to use IntelliJ IDEA's built-in "Share project on GitHub" option. When I click on it, I am asked to log in to GitHub, which I do successfully, and then choose the files I want to commit so that they can be pushed to the repository.
The problem is that, while this does indeed create an empty repository on GitHub, it doesn't push the initial commit, and instead throws an error at me:
Successfully created project 'project' on GitHub, but initial push failed: unable to access 'https://github.com/alt/project.git/': The requested URL returned error: 403
git remote add origin git@github-alt:alt/project.git
git push -u origin master
git remote add origin git@github-alt:alt/project.git && git push -u origin master pushes code to repository associated with alt account.
But this doesn't modify author of existing commits. The commits made so far has main username associated. Changing username in entire commit history requires git history rewrite.
#!/bin/sh git filter-branch --env-filter ' OLD_EMAIL="email@example.com" NEW_NAME="alt" NEW_EMAIL="firstname.lastname@example.org" if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] then export GIT_COMMITTER_NAME="$NEW_NAME" export GIT_COMMITTER_EMAIL="$NEW_EMAIL" fi if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ] then export GIT_AUTHOR_NAME="$NEW_NAME" export GIT_AUTHOR_EMAIL="$NEW_EMAIL" fi ' --tag-name-filter cat -- --branches --tags
Do a force push after verifying git history.
git push --force --tags origin 'refs/heads/*'