GIT命令问题
问题描述:
我试图执行git clone命令从github存储库中克隆源代码。我正在使用2.11.1版本。我运行的命令是 git clone https://username:[email protected]/repository.git ./localpath
这适用于Windows机器。但是,当我从linux机器执行命令是删除@和抛出错误。执行失败就像GIT命令问题
有人能帮助我解决这个问题?
答
注册您的ssh-keygen生成的id到Github,所以它不会提示您输入密码。
$ ssh-keygen
无需输入密码短语。输出你的公钥,然后复制到github
$ cat ~/.ssh/id-rsa.pub
但是,如果你真的想走那条路。 用单引号括起来,或者像下面这样做。
#!/bin/bash
REPO='https://username:[email protected]/repository.git'
LOCAL_PATH='path/to/wherever'
git clone "$REPO" "$LOCAL_PATH"
注:变量使用双引号
你有没有试图逃跑用\的@字符? – user2773289
你用什么外壳? – mipadi
@mipadi使用bash shell。 – Eldo