Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable Git Autocomplete in MacOS?

Tags:

macos

zsh

I'm using Mac OS Monetary and Recently installed Git for a project. I followed the below steps to activate the Git Autocomplete feature for Git commands and Branch names. I got success in my Previous Macbook with MacOS Catalina, but it's not working on Monetary. The Error is, "zsh: permission denied: /Users/username/.zshrc" when I run "~/.zshrc"

Steps Are:

Run in Terminal

curl -o git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash

curl -o _git https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.zsh

~/.zshrc

Update the File with

zstyle ':completion:*:*:git:*' script ~/.zsh/git-completion.bash
fpath=(~/.zsh $fpath)

autoload -Uz compinit && compinit

And Run

source ~/.zshrc

How can I solve this?

like image 384
David Johns Avatar asked Aug 31 '25 14:08

David Johns


1 Answers

I edited the file with vim

vim ~/.zshrc

add the following to the end of the file

autoload -Uz compinit && compinit

relaunch your shell and you should have git completions

git checkout my_branch<tab>

should tab complete the branch name for you.

like image 90
Harry Moreno Avatar answered Sep 13 '25 15:09

Harry Moreno



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!