I am using git for source control and push my changes to a repository on a server on the internet for safe keeping.
I can do some small amounts of coding on a laptop on a train, which has a wifi internet connection but it's not that reliable and occasionally drops out or becomes unusable slow. My question is what happens if my connection is lost during a "git push"? Will I end up with a corrupted or half updated git repository? And if so, how difficult is it to recover it?
Here are the main reasons why Git is not secure: There are no authentication or verification measures. You can only control Git with server access. And developers can easily rewrite your change history.
git-secret encrypts files and stores them inside your git repository, providing a history of changes for every commit. git-secret doesn't require any extra deploy operations other than providing the appropriate private key (to allow decryption), and using git secret reveal to decrypt all the secret files.
Yes, you can use Git offline. Git only requires an Internet connection when you use commands such as git remote , git pull , and git push with a remote repository that is stored on an Internet server.
Change the current working directory to your local project. Initialize the local directory as a Git repository. Add the files to your new local repository. Commit the files that you've staged in your local repository.
Git will not corrupt or "half update" your Git repository just because of a failed or slow connection. It's very robust and I would still feel comfortable using it even in the most arduous circumstances.
The actual push
function is implemented in essentially two steps (in the case of a fast-forward push, which should always be the case):
The first operation is idempotent, so if it fails for any reason halfway through, you can simply run it again to get everything up to date. The second operation is atomic and only happens once all the new objects are uploaded.
According to Linus git is so well secured on the data area that it would even detect a memory error on the system it's running on. It will simply not apply the packets that arrive at the server that have an invalid checksum, so you have nothing to worry about.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With