Location ~ C:\Users\user\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 If not already exist create it
Ex whereis git and it returns path of node C:\Users\user\scoop\shims\git.exe
Useful for checking like if you have two exes are installed on the system like which one is currently in use.
function whereis ($command) {
Get-Command -Name $command -ErrorAction SilentlyContinue |
Select-Object -ExpandProperty Path -ErrorAction SilentlyContinue
}change the default prompt
function prompt {
$esc = [char]27
$reset = "$esc[0m"
$cyan = "$esc[36m"
$green = "$esc[32m"
$red = "$esc[31m"
$yellow = "$esc[33m"
$currentPath = Get-Location
$gitBranch = ''
$gitStatus = ''
if (Test-Path .git) {
$gitBranch = git rev-parse --abbrev-ref HEAD 2>$null
$statusOutput = git status --porcelain 2>$null
if ($statusOutput) {
$gitStatus = '*'
}
}
"$cyan$currentPath $green$gitBranch$gitStatus$yellow✘$reset "
}go here install scoop and git
quick tip i installed git with winget --scope machine and its giving me problems i have to use sudo + inline to work and sometimes it didn't even work.
feture self please use scoop for git
admin and scope user both have different execuation policies setup wisely.
this thig is also useful for nodejs like script execution disabled or something.
Current execution policy check
Get-ExecutionPolicySet Execution Policy
Set-ExecutionPolicy unrestrictedgenerate the keys
ssh-keygen -t ed25519 -C "[email protected]"set username globally
git config --global user.name "Dixit"set email globally
git config --global user.email "[email protected]"Tells Git to use SSH keys (not GPG) for commit signing.
git config --global gpg.format sshSets the public SSH key file you want Git to use for signing commits. Replace the path if your key is elsewhere.
git config --global user.signingkey C:\Users\user\.ssh\id_ed25519.pubMakes Git sign all commits by default, so you don’t have to add -S every time.
git config --global commit.gpgsign trueNot Mandatory but you can do this
Some Windows Things (Run Powershell as Admin)
This ensures the ssh-agent starts every time you log into Windows
Get-Service ssh-agent | Set-Service -StartupType AutomaticCurrently start ssh agent service
Start-Service ssh-agentAdd your keys to ssh-agent (after pasting try hitting with tab does it autocomplete to absolute path)
ssh-add %USERPROFILE%\.ssh\id_ed25519Verify the key is loaded
ssh-add -l| Char Code | Size | Width |
|---|---|---|
|
─ ─ | |
  |
─ ─ | ~1/5 space |
  |
─ ─ | Very thin |
  |
─ ─ | Slightly thinner than |