Git工作正常.我在Git中创建了一个别名,但问题是当我尝试重新打开终端时,我需要. ~/.bashrc
每次都在终端中运行.
每次重新打开终端时,我不需要提供源的最佳方式是什么?
我做了什么?
我试图在此文件中添加source
该.bashrc
文件,但它是一个只读文件.我不能添加source
的的.bashrc
文件,在此配置文件.
open /etc/profile
Run Code Online (Sandbox Code Playgroud)
添加了在配置文件中写入的权限,仍然无法链接源文件.
sudo chmod u+w /etc/profile
Run Code Online (Sandbox Code Playgroud)
轮廓:
# System-wide .profile for sh(1)
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi
Run Code Online (Sandbox Code Playgroud)
根据@Aserre 的回答,我已按照此步骤解决此问题
操作系统的典型安装不会为您创建 .bash_profile。当您想从命令行运行函数时,这是必不可少的。
cd ~/
以转到您的主文件夹touch .bash_profile
以创建新文件。open -e .bash_profile
在 TextEdit 中输入以打开它。[ -f "$HOME/.bashrc" ] && source "$HOME/.bashrc"
保存并关闭它重新启动终端,它应该可以工作