Last active
December 1, 2024 06:27
-
-
Save HanjoStudy/866cbdcee74cb7009695090063a62206 to your computer and use it in GitHub Desktop.
Github reset before prod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Option 1: Clone from github ------------------------------- | |
# Create token in Github, use pat as password | |
# Use dedicated Repo PAT, owner to distribute | |
# Option 1: Clone from github ------------------------------- | |
# apt-get install git-flow | |
# Create token in Github | |
git init | |
git config --global credential.helper store | |
git config --global credential.helper 'cache --timeout 7200000' | |
$ git credential fill | |
protocol=https | |
host=github.com | |
username=your_username | |
password=your-personal-access-token | |
$ git credential approve | |
protocol=https | |
host=github.com | |
username=your_username | |
password=your-personal-access-token | |
$ git remote add origin https://github.com/username/repository.git | |
$ git pull origin master | |
$ git add . | |
$ git commit -m "init" | |
$ git push --set-upstream origin master | |
chmod 600 ~/.git-credentials | |
# Check with | |
$ git config --list | |
# Once successful | |
rm ~/.git-credentials |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a new orphan branch | |
git checkout --orphan temp_branch | |
# Add files to new branch | |
git add -A | |
git commit -m "Initial commit" | |
# Delete original master branch | |
git branch -D master | |
# Rename orphan branch | |
git branch -m master | |
# Push changes (if necessary) | |
git push -f origin master | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment