Tag: Automation

  • GIT_SSH_COMMAND – Effortless SSH Key Switching in Git

    When working with multiple Git repositories — especially private ones — you often find yourself juggling SSH keys. Your local environment might be configured for long-term projects, and setting up permanent access to a one-time repository can be overkill.

    Instead of modifying your global SSH config, use the GIT_SSH_COMMAND environment variable to tell Git which key to use for a specific operation.


    Example

    Let’s say you have a separate key ~/.ssh/deploy_key for a private repo. To clone it without touching your SSH config:

    GIT_SSH_COMMAND="ssh -i ~/.ssh/deploy_key" git clone git@github.com:username/private-repo.git

    When It’s Useful

    • In CI/CD pipelines that need SSH access to private repos.
    • When managing multiple identities on a single machine (e.g., personal, corporate, freelance).
    • For temporary access to third-party repositories.
  • How to send GitHub updates to Discord

    Part 1 — Discord

    1. Open the desired Discord channel where you want to post commit messages and other GitHub updates.
    1. In the channel settings, find the Webhooks section and create a new webhook.
      ⚠️ Note: Do not share this URL! Anyone with the link can post messages to this channel, even without being on the server.

    Part 2 — GitHub

    1. Go to your GitHub repository and open the Settings tab.
    1. In the Webhooks section, click “Add webhook”.
    1. In the “Payload URL” field, paste the Discord webhook URL from step 2 and make sure to add /github at the end — otherwise, the integration won’t work.
      • In “Content type”, select application/json
      • In “Which events would you like to trigger this webhook?”, choose the types of events you want to trigger notifications.
    1. Test the integration by making a commit or another change in the repository.