.gitconfig别名函数调用(.gitconfig alias function call)

编程入门 行业动态 更新时间:2024-10-13 06:16:46
.gitconfig别名函数调用(.gitconfig alias function call)

我在.gitconfig中定义了以下别名:

[alias] teamcity = ! tc

tc是我在.bashrc文件中定义的shell函数。 出于某种原因,我收到以下错误:

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

有谁知道我能做些什么来解决这个问题? 我想尽可能将函数保存在我的.bashrc文件中。

I have defined the following alias in my .gitconfig:

[alias] teamcity = ! tc

tc is a shell function I defined in my .bashrc file. For some reason, I get the following error:

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

Anyone know what I can do to solve this? I'm trying to keep the function in my .bashrc file if possible.

最满意答案

就这样吧

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

当别名在bash启动文件之外定义时,这将不起作用。 但你清楚地说明它在.bashrc中,所以你很好

Make it like so

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

This won't work when the alias is defined outside the bash startup files. But you clearly state it's in .bashrc, so you're good

更多推荐

本文发布于:2023-08-05 04:02:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1428142.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:别名   函数   gitconfig   call   function

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!