-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqwasar_git.sh
More file actions
executable file
·52 lines (46 loc) · 1.44 KB
/
Copy pathqwasar_git.sh
File metadata and controls
executable file
·52 lines (46 loc) · 1.44 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# Qwasar Git Helper Script
# Usage: ./qwasar_git.sh <email> <git-command>
# Example: ./qwasar_git.sh abutalibsiriyev2003@gmail.com clone git@git.us.qwasar.io:xxx/xxx.git
if [ $# -lt 2 ]; then
echo "Usage: $0 <email> <git-command> [args...]"
echo ""
echo "Examples:"
echo " $0 user@example.com clone git@git.us.qwasar.io:xxx/xxx.git"
echo " $0 user@example.com pull"
echo " $0 user@example.com push origin main"
echo ""
echo "Available SSH keys:"
if [ -d ".ssh" ]; then
for dir in .ssh/*; do
if [ -d "$dir" ] && [ -f "$dir/account_info.txt" ]; then
echo " - $(basename "$dir" | sed 's/_at_/@/g; s/_/./g')"
fi
done
else
echo " No SSH keys found. Run req_based.py first."
fi
exit 1
fi
EMAIL=$1
shift
# Convert email to safe directory name
EMAIL_SAFE=$(echo "$EMAIL" | sed 's/@/_at_/g; s/\./_/g')
SSH_DIR=".ssh/$EMAIL_SAFE"
CONFIG_PATH="$SSH_DIR/config"
if [ ! -f "$CONFIG_PATH" ]; then
echo "Error: SSH config not found for $EMAIL"
echo "Expected path: $CONFIG_PATH"
echo ""
echo "Available SSH keys:"
if [ -d ".ssh" ]; then
for dir in .ssh/*; do
if [ -d "$dir" ] && [ -f "$dir/account_info.txt" ]; then
echo " - $(basename "$dir" | sed 's/_at_/@/g; s/_/./g')"
fi
done
fi
exit 1
fi
echo "Using SSH key for: $EMAIL"
GIT_SSH_COMMAND="ssh -F $CONFIG_PATH" git "$@"