blob: e851f1b3c57371cf980d32aef02b3fbdeb911f13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/bin/bash
if ! sudo grep -q "^AllowAgentForwarding yes" /etc/ssh/sshd_config; then
echo "AllowAgentForwarding not set. Adding it to sshd_config..."
echo "AllowAgentForwarding yes" | sudo tee -a /etc/ssh/sshd_config > /dev/null
echo "Added AllowAgentForwarding yes to /etc/ssh/sshd_config"
else
echo "AllowAgentForwarding is already set to yes in /etc/ssh/sshd_config"
fi
# this should be enabled on both client and server
# Get the directory of this script
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# Path to the git-ssh-wrapper.sh
WRAPPER_PATH="$SCRIPT_DIR/tools/git-ssh-wrapper.sh"
# Check if the wrapper script exists
if [ ! -f "$WRAPPER_PATH" ]; then
echo "Error: git-ssh-wrapper.sh not found at $WRAPPER_PATH"
exit 1
fi
# Make sure the wrapper script is executable
chmod +x "$WRAPPER_PATH"
# Set the global Git SSH command
git config --global core.sshCommand "$WRAPPER_PATH"
echo "Git SSH command has been set to use $WRAPPER_PATH"
echo "You can verify this by running: git config --global --get core.sshCommand"
#ssh-agent bash -c 'ssh-add ~/key && ssh -A -p24 user@code.server'
|