Tuesday, August 16, 2022
HomeCyber SecurityEradicating Delicate Recordsdata from GitHub and All Their Historical past | by...

Eradicating Delicate Recordsdata from GitHub and All Their Historical past | by Teri Radichel | Bugs That Chew | Aug, 2022


Errors attempting to run git filter-repo — invert-paths

I’ve been working this sequence of weblog submit and seen that some .swp recordsdata received into my github repo. I wished to take away them. Whenever you merely delete a file and examine in your code once more, the file shouldn’t be utterly gone. It nonetheless exists within the historical past and will be retrieved.

If you wish to see recordsdata which were deleted from git:

git log --diff-filter=D --summary

You may retrieve deleted recordsdata (I didn’t attempt these instructions so use at your personal threat — make a backup first):

Let’s say you see a file that you just wish to utterly take away. Github has a web page about this:

I used the filter-repo choice. First I received an error that filter repo didn’t exist. I’m working some updates on an Amazon Linux EC2 occasion so I needed to set up filter-repo.

python -m pip set up --user git-filter-repo

I received a bunch of errors after attempting to run the command to take away the file. I ended up working the instructions beneath however unsure what is definitely obligatory as a result of labored as a result of I didn’t monitor what I used to be doing very properly:

#backup native repo
mv [my repo folder] [backup file name]
#begin with a clear repo for greatest outcomes
git clone https://github.com/[your github repo].git
#take away the undesirable file
git filter-repo --invert-paths --path iam/batch_job_role/.deploy.sh.swp
#add git ignore file
echo *.swp >> .gitignore
git commit -m "Add .gitignore"
#pressure an overwrite of the distant listing
git push origin --force --all
#for some cause my origin disappeared
git distant add origin https://github.com/[repo].git
#I could not push with out working the next instructions first
git add .
git commit -m "add git ignore"
git config --global consumer.identify [your username here]
git push --set-upstream origin predominant
#sooner or later I needed to run this command:
git config pull.rebase true

Then I eliminated one other file and didn’t appear to get all of the errors once more. However then I received this error if I merely attempt to run git pull:

There isn't a monitoring info for the present department.Please specify which department you wish to rebase in opposition to.See git-pull(1) for particulars.git pull <distant> <department>When you want to set monitoring info for this department you are able to do so with:git department --set-upstream-to=origin/<department> predominant

Some mixture of the next resolved the issue:

git distant add origin https://github.com/[repo].gitgit push origin --force --allgit config pull.rebase truegit distant add origin no@spam.com/[your username here]/[repo].gitgit push origin --force --allgit distant add origin https://github.com/[username]/[repo].gitgit config --global consumer.identify [username]git push --set-upstream origin predominant

Teri Radichel

When you appreciated this story please clap and observe:

Medium: Teri Radichel or Electronic mail Checklist: Teri Radichel
Twitter: @teriradichel or @2ndSightLab
Requests providers by way of LinkedIn: Teri Radichel or IANS Analysis

© 2nd Sight Lab 2022

____________________________________________

Creator:

Cybersecurity for Executives within the Age of Cloud on Amazon

Want Cloud Safety Coaching? 2nd Sight Lab Cloud Safety Coaching

Is your cloud safe? Rent 2nd Sight Lab for a penetration check or safety evaluation.

Have a Cybersecurity or Cloud Safety Query? Ask Teri Radichel by scheduling a name with IANS Analysis.

Cybersecurity & Cloud Safety Assets by Teri Radichel: Cybersecurity and Cloud safety courses, articles, white papers, displays, and podcasts



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments