2011-06-27 33 views
2

我在我的.gitconfig定義以下別名:的.gitconfig別名函數調用

[alias] 
    teamcity = ! tc 

tc是我在.bashrc文件中定義的外殼功能。出於某種原因,我得到以下錯誤:

[aafghani-03:~/git/workday amirafghani(master)]$ git teamcity 
tc: tc: command not found 

任何人都知道我能做些什麼來解決這個問題?如果可能的話,我試圖保留函數在我的.bashrc 文件中。

回答

5

使它像這樣

git config alias.teamcity '!bash -ic tc' 

當別名bash的啓動文件外定義這是行不通的。但你清楚地說明它在.bashrc中,所以你很好

+1

如果參數傳遞給'git teamcity',這將無法按預期工作。你可能想要這樣的東西,而不是:'git config alias.teamcity'!bash -ic'\''tc「$ @」'''''''''''''''''''' –

+0

@Richard:好的加法,thx – sehe

+0

Richard –