Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Monday, 14 September 2020

Gitk permissions on Alacritty

Recently, I started using Alacritty instead of the Terminal app provided by Apple. It sure is much faster.

There seems to be a new and annoying security feature introduced by Apple that has granular permissions for applications downloaded from the internet. So, Alacritty does not start with the same permissions as Terminal. Setting that up is a bit of a hassle. When I started gitk, it asked for some permission and I could not understand it then so I denied it. So, gitk did not work. I thought restarting Alacritty might request permissions again but that is not the case. The error I was getting is as follows:

 % gitk
Error in startup script: 58:102: execution error: Not authorised to send Apple events to System Events. (-1743)
    while executing
"exec osascript -e [format {
        tell application "System Events"
            set frontmost of processes whose unix id is %d to true
        end te..."
    invoked from within
"if {[tk windowingsystem] eq "aqua"} {
    exec osascript -e [format {
        tell application "System Events"
            set frontmost of processes ..."
    (file "/usr/local/bin/gitk" line 12261)

So, I had to find the right permission and grant that to get gitk working. The System Events permission is apparently under Automation section. Once that is granted, Alacritty can run gitk.

Monday, 20 June 2016

Detailed changes of a stash

I have been using git for a few years now. Stashing is one of the very frequent operations I do on git. So, on a number of occasions, I find myself with the need of looking into what the stash contains (Perhaps, I should branch more and stash less). The following command, which shows the detailed changes in a particular stash, does come in handy in those situations.

 git stash show -p stash@{1}

Thursday, 28 April 2016

Pull from a shared Windows machine

As a distributed version control system, one of the benefits of using git is that you can pull from anyone's repo just as you would do from a server. With Git's support for SSH, it is very easy to do it on Linux. Two Windows machines don't talk SSH to each other though. So, I was not sure  how to pull from my repo on one Windows machine to another. It turned out equally easy though (may be easier).

git pull file:////<machine_name>E$/path/to/repo/root

Drives like E: and C: get replaced by E$ and C$ respectively. As both of my machines were on the same domain, it was easy. Sharing might come into picture for machines on different domains.

Monday, 27 April 2015

Finding remote URL of a folder under git

I was trying to recover an old codebase. I could see that it had two remotes one of which was now rejecting pushes. So, I figured the remote must have changed. To verify, I needed to see how to find out the remote URL. I found there are three ways of doing it as follows:
  1. git remote show remote_name # this failed for me as the remote URL was unavailable
  2. git config --get remote.heroku.url # this solved my purpose
  3. git remote -v # simplest of all to remember

Friday, 27 April 2012

Using multiple keys for github

Recently, I was working from my office laptop. I had set up ssh keys for Github on that system. However, when I had to work from my personal system, I realized that I don't have those ssh keys with me on this system. Also, the ssh keys on the current system were used for another purpose. So, I decided to have multiple keys on Github as well as on my system. I created my new keys with the following command:

ssh-keygen -t <rsa/dsa as per your choice> -f <new private key file like ~/.ssh/id_dsa.github> -C "comment"

This created a new key pair for me. Now, I had to configure ssh to use this key for github. So, I added the following lines to ~/.ssh/config file.

Host github.com
IdentityFile ~/.ssh/id_dsa.github
User git


Now, I had to add this new key to my ssh keys on Github. I opened the new public key file (id_dsa.github.pub in the above case) and copied its contents to add a new key on Github. I tried ssh -vT git@github.com and verified that it was using the new key and I was able to access Github successfully.

OpenSSH_5.9p1, OpenSSL 1.0.0g 18 Jan 2012
debug1: Reading configuration data /home/me/.ssh/config
debug1: /home/me/.ssh/config line 9: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /home/me/.ssh/id_dsa.github type 1
debug1: identity file /home/me/.ssh/id_dsa.github-cert type -1

Sunday, 24 April 2011

Generating public and private keys

Asymmetric keys are often used so I shall describe two ways of generating them. Using openssl we can generate them as follows:

openssl genrsa -out key.priv 1024
openssl rsa -in key.priv -out key.pub -pubout


The key pair generated above can be used as follows:
- distribute the public key so that messages can be encrypted using the public key
- use the private key to decrypt them

Whenever there is the need for a password, the ssh format for RSA and DSA keys can be used. An ssh key-pair can be generated in the following way.

ssh-keygen -t rsa -b 2048