From ArchWiki
Revision as of 17:15, 21 February 2014 by Frank (talk | contribs) (Git prompt: duplicated?)
Jump to: navigation, search

Merge with Gitweb

As said, the sections to get git working over ssh, http and the git protocol should in my opinion be placed in this article.
-- Markg85 5 March 2011

Bash completion

Unless I'm mistaken, bash completion comes with git now so the instructions should be changed to simply:

source /usr/share/git/completion/git-completion.bash


Maybe note that it's also possible by installing bash-completion?
-- Xerdomii 6 May 2011

The default /etc/bash.bashrc (from the bash package) sources /etc/bash_completion (optionally from the bash-completion package) if it exists. The bash_completion script intern sources files in /etc/bash_completion.d/ if they exist. With Arch's git package a copy of /usr/share/git/completion/git-completion.bash ends up in the /etc/bash_completion.d/ directory. So, if you have the bash-completion package installed, completion for git should work automatically as soon as /etc/bash.bashrc is processed.
-- James Eder 13:27, 20 June 2011 (EDT)
AFAIK, bash-completion does not put anything into /etc/bash_completion.d/, so the current instruction is misleading. The thread __git_ps1 isn't found anymore seems to be the only accurate guide available, at the moment.
-- Mloskot (talk) 19:52, 19 September 2012 (UTC)

Smart HTTP

Trying to follow the instructions to set up HTTP access, I ran into following issue:

error: Cannot access URL http://<server>/git/example/, return code 22
fatal: git-http-push failed

Acccording to the config file on the remote repository needs to get a couple new lines:

   receivepack = true

After this little change it all works for me.
-- User:Gunnar 4 May 2012

Git prompt

I've tried the method explained here to add git status and features to a zsh prompt, but to no avail.

The method explained here to add git status and features to a zsh prompt did not work in my case.

A stackoverflow answer [1] worked well for me. Here is what I added to my .zshrc:

setopt prompt_subst
autoload -Uz vcs_info
zstyle ':vcs_info:*' actionformats \
    '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
zstyle ':vcs_info:*' formats       \
    '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f '
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
zstyle ':vcs_info:*' enable git cvs svn
vcs_info_wrapper() {
  if [ -n "$vcs_info_msg_0_" ]; then
    echo "%{$fg[grey]%}${vcs_info_msg_0_}%{$reset_color%}$del"

Has anyone else had a similar issue? If so, I'll update the page to match this fix. Qguv (talk) 00:09, 4 August 2013 (UTC)

By the way, is included two times in git: in usr/share/git/completion/ and usr/share/git/

IMHO, usr/share/git/completion/ can be removed, because it has nothing to do with command line completion. Frank (talk) 17:15, 21 February 2014 (UTC)