【问题标题】:bash: syntax error near unexpected token `'git config --global user.name "firstname lastname"''bash:意外令牌''git config --global user.name“firstname lastname”''附近的语法错误
【发布时间】:2020-06-03 19:22:26
【问题描述】:

我正在尝试设置我的 SSH 密钥,以便我可以将我的程序代码从 RStudio 推送到我创建的 GitLab 存储库。

在我的 RStudio 终端中运行以下命令

$ system('git config --global user.name "firstname lastname"')

返回以下错误:

bash: syntax error near unexpected token 'git config --global user.name "firstname lastname"''

所以我猜 RStudio 不喜欢引号,但我已经尝试了双引号和单引号的所有组合,我仍然得到 bash: syntax error

任何想法我做错了什么?

【问题讨论】:

    标签: bash git rstudio


    【解决方案1】:

    您正在与一个需要像 git 这样的 shell 命令的 Bash shell 交谈,而不是需要像 system(..) 这样的 R 表达式的 R repl。删除system(..),直接运行命令:

    $ git config --global user.name "firstname lastname"
    

    【讨论】:

    • 是的,这就是问题所在 - system(...) 命令应该在 RStudio 控制台中运行。
    猜你喜欢
    • 2019-10-13
    • 1970-01-01
    • 2023-04-01
    • 2014-02-26
    • 2018-12-18
    • 2014-01-20
    • 2015-12-11
    • 2021-07-29
    • 2014-06-04
    相关资源
    最近更新 更多