git-crypt fails to recognize cloned repository - git-crypt

I have two computers, a desktop and a laptop. I setup gpg and git-crypt on the desktop, and it seems to be working great. I can encrypt and decrypt individual files with gpg, as well as sign git commits on both laptop and desktop. That's working great.
I exported my public and private keys gpg keys on the desktop and imported them on the laptop.
But, git-crypt seems to only work on the desktop. It transparently encrypts files when pushed to Github, but when I clone the repository on my laptop I can see the encrypted files, but git-crypt says they are not encrypted, and refuses to actually decrypt them.
Running git crypt unlock prompts me for my GPG key, and seems to accept it, but doesn't actually do anything.
I'm not sure what's going on, or how I can make git-crypt recognize that it's actually an encrypted repository. Any suggestions?
➜ Vimwiki git:(master) git crypt status
not encrypted: .git-crypt/.gitattributes
not encrypted: .git-crypt/keys/default/0/7405D8B8BCCCEA723B3BA6615AEA60852688245D.gpg
not encrypted: .gitattributes
not encrypted: index.md
➜ Vimwiki git:(master) git crypt unlock
➜ Vimwiki git:(master) cat index.md
GITCRYPT_5?hV?b_g$<8??M)?blablabla…
➜ Vimwiki git:(master)

Related

remove git secrets from Ubuntu

I have added git secrets to ubuntu(16.04 LTS) and it was working fine until I was executing these commands,
git secrets --register-aws
git secrets --install ~/.git-templates/git-secrets
git config --global init.templateDir ~/.git-templates/git-secrets
I have removed these files,
~/.git-templates/git-secrets
/usr/bin/git-secrets
from my environment, but still it seems not working fine.
git secrets --scan , gives nothing
How do I remove git-secrets permanently from my PC and re-install or solve this issue.
Currently we need to do this manually.
Delete secrets from .git/config for all local repositories.
Delete secrets from .gitconfig.
Remove commit-msg, pre-commit and prepare-commit-msg hooks from all git repositories.
Change/remove git template so that it does not configure these hooks for newer repos.
Uninstall binary. Following are the multiple places you can look in the Linux based machine.
i. By default all the git core command scripts are available in /usr/lib/git-core/ directory.
ii. Apart from that, you can check in /usr/bin/ and /usr/local/bin/ directories as well.
iii. If you are still NOT able to find the binary, then type which git-secrets to identify the place where actually git-secrets is installed.
There is an issue created for the same in GitHub. You can check the progress in there as well.

How to use а private repository with VSCode?

A novice here, please type a small instruction describes how to use a private GitHub repo in VSCode
To configure a private repo, you first need to generate a public/private RSA key pair on your dev machine to be able to establish an ssh connection to your repo instead of an HTTP connection.
Just install Git for Windows in your development environment. During installation, please make sure that you have checked the option to include git bash, as you'll need it to create this key. Once installed, right click on your Windows user folder, select on Open git bash and then just run ssh-keygen (or if you are using Linux, you can just ssh-keygen) and go through the wizard.
This step will create a hidden .ssh folder that contains your public/private RSA key pair. Navigate to that folder.
The goal here with these keys is to configure your public key on GitHub. Open your id_rsa.pub file with notepad and copy its entire content. Then go to GitHub and under your user Settings > SSH keys just add a key and paste your entire public key plus an arbitrary name.
Now restart VS Code and press CTRL+ ' (Backtick) to open PowerShell and then run:
In case you haven't cloned your repo:
git clone git#github.com:{UserName}/{RepoName}.git
To Upload changes to your repo:
git add .
git commit -m "{Name for this commit}"
git push {Repo Origin name (default = Origin)} {Branch Name (Default = Master)}
Note. {} are for reference, do not include them in your commands.
VS Code has built-in support for Source Control, so if it is configured, VS Code will automatically detect changes and get them ready to commit with just a commit message and click. Also, there's a really good VS Core extension called GitLens. This can help you to 1-click push
That should do it. 😃
As of now (july 2019, not sure when this got added exactly) you can do this from within VSCode, just hit F1 in windows or ctrl+⇧+P (or ⌘+⇧+P on mac) to access the command palette of VSCode, then type or select Git: Clone and finally enter the URL of your repository, so something like https://github.com/MY_USERNAME/MY_PROJECT.git, finally choose the folder you want to use for your cloned repository (open the main folder that contains all your projects, no need to manually create a sub folder for the project itself, git will do this for you using the projects name)
To find your exact repository URL, open the projects github page and click on the green button on the top right that says "Clone or download", if you wonder if you should use HTTPS or SSH check out the github documentation
I had trouble with cloning a private repository from Github with VSCode. In my case the problem was that I followed Github docs instructions to generate SSH keys with Ed25519 algorithm and using these keys (id_ed25519.pub) with VScode and Github did not work for me.
I generated new keys with the RSA algorithm:
ssh-keygen -t rsa -b 4096 -C "your_email#example.com"
and after adding id_rsa.pub to my Github account settings VSCode started working with private repositories.
If Git is already installed
Copy the URL of your private repository
Go to the version control in VS Code
Click on clone repository (authentication required if not done already) and
Paste the copied URL in the edit text box as shown in the documentation.
i have same problem- but solution was simple:
Mistake was: in windows when you create a keys name should be "id_rsa" (windows cmd suggest rename yor keys).
if your key name is different simple rename private and public keys to "id_rsa" and "id_rsa.pub"
Then add keys via: ssh-add ~/.ssh/id_rsa (edit path if files in different).
Then add id_rsa.pub key to github profile settings(copy paste of content).
Now you can work with private repositories.
#Daniel summed it up but quick read for anyone who's having issues with generating ssh/adding it to github.
As #Kennet stated use ssh-keygen -t rsa -b 4096 -C "your_email#example.com" hit enter through, it will default to C:Users most likely.
Copy the ida_rsa.pub generated in github go to Setting -> Deploy keys (documentation I saw was outdated) and paste it in and name it ida_rsa.pub.
Note: Make sure to select "Allow write access" otherwise your pushes will be denied
If you want multiple ssh keys, this document explains how

Host Key Verification Failed - GitLab with Visual Studio Code on macOS

I keep getting a "Host Key Verification Failed" error when trying to push changes to a git controlled folder/project to Gitlab. For whatever reason, it works fine using Visual Studio for Mac, and I can login to my Gitlab account just fine via web browser.
Resolved by deleting any/all Known_hosts files in ~/.ssh/ and then executing ssh git#gitlab.com in Terminal and answering "yes" (which re-adds git#gitlab.com to known_hosts after re-creating a new known_hosts file).
I did some messing around in known_hosts which probably caused the problem.
I found that my home profile was loading as "P:\" in git bash (because of my work's IT team...).
Ensure that in git bash you have generated an ssh key using ssh-keygen and that GitLab knows about the key.
If you still have the issue, run ssh -o StrictHostKeyChecking=no <gitlab-host> uptime to make gitlab trusted.
I re-created ssh keys in git for Windows and it worked!
In Windows, I was receiving this error from Git on MS Visual Studio Code.
I had to launch it from Git Bash to pull in my git and ssh environment configuration.
<your git bash prompt> $ Code
VS Code should Launch, and you should be able to clone a repo via ssh then.
The problem is with known_hosts file only. I already had an entry for the remote server in this file. After deleting existing entry for the remote server I was able to follow the steps to login to remote server and then add a new entry for same in known_hosts file.

How to make eclipse remember ssh key passphrase?

I'm using Egit with Eclipse to use git and access github. Everything is working fine but one thing that I wish to omit to type id_rsa key passphrase everytime I push my commit to github.
I'm asked to enter passphrase each time I restart Eclipse and try to push.
How can I make eclipse remember passphrase so that I don't have to type manually?
Thanks
Even if ssh-add -l lists your passphrase-protected key, EGit may not honour it and still ask for passphrase.
To integrate with OS keyring on Ubuntu or Mac OS X put
export GIT_SSH=/usr/bin/ssh
to your ~/.bash_aliases or whenever applicable for your OS.
Use the ssh agent.
Add your key to the agent with ssh-add. (This will ask you for your passphrase.)
Afterwards the agent should do all the authentication. (No passphrase needed anymore.)
Details:
try to access your repository manually: cd $your_repository; git fetch -> it should ask for your passphrase
enter ssh-add -l -> it should output "The agent has no identities."
enter ssh-add -> it should ask you for your passphrase
enter ssh-add -l -> it should list one identity (the key you just added)
try to access your repository again: cd $your_repository; git fetch -> it should now work without asking for your passphrase
try to access your repository from eclipse. -> again, no passphrase should be needed.

git push error "fatal: Unable to find remote helper for 'https'"

I've added remote origin like:
git remote add origin https://github.com/username/repo.git
When I push the git repository, I get this error:
git push -u origin master
fatal: Unable to find remote helper for 'https'
I am on git 1.7.1 on Ubuntu 10.04.4 LTS
Any ideas, greatly appreciated
If you compiled git from source, be sure to install this package first:
apt-get install libcurl4-openssl-dev
I just got the problem yesterday and solved it today, so am posting in case this might help a Windows user. For me, the problem occurred after I updated to the latest version of Git (because Visual Studio was recommending I do so-- something about things not matching.)
It turns out that I installed in the default directory Program Files, but my old Git was in Program Files (x86). (Hadn't noticed until tried reinstalling.)
Uninstalling the new version and installing the 64-bit Git for Windows Setup listed under Other Git for Windows downloads (which is not the default) overlaying the version in Program Files (x86) worked. (I tried other combinations of version and folders first.)
I did have to delete the local repository already created and restart with git init, git add ., git commit -m "first commit", git remote add origin theGitUrl (all of which worked before), before doing the git push origin master. The weird thing is that a pop-up window appeared to enter my user name and password. I didn't notice it at first and thought the processing on the git push was hung up. So, heads up about that "Other Git for Windows" version.
I did change my Environmental Variables before the fix; I don't know if that helped. I added these 2 to the PATH:
C:\Program Files (x86)\Git\bin
C:\Program Files (x86)\Git\libexec\git-core
I did this for both User and System variables.
A note on updating the PATH in Windows 10: you have to add one at a time and not include the ;
After much searching, the answer is you need git version 1.7.7
Can't update RVM - "fatal: Unable to find remote helper for 'http'"
I was working in a chroot jail and thought i had copied everything i needed for git to work but i was missing the git-core files themselves so i just had to copy them:
cp -r /usr/lib/git-core /opt/chroot/myjail/usr/lib/
Add this to git config: (Checked in centos 6.7 and working)
#git config --global url.https://.insteadOf git://
#To see the config added
#git config --list
url.https://.insteadof=git://
user.name=username
user.email=youremail
....