【发布时间】:2021-06-07 18:41:27
【问题描述】:
我已生成我的 SSH 密钥并将其添加到 Github。
现在我正在尝试编写一个脚本,在 Github 中生成一个新的私有存储库并上传初始文件。系统将提示用户输入新存储库的名称。
下面给出了我的代码。问题是尝试将文件推送到 Github 时出现以下错误
ssh: Could not resolve hostname github.com:rongardF: Name or service not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
为什么会出现此错误?我还有什么需要做的吗?
代码:
@echo off
set /p name="Enter new project name: "
touch README.md
touch .gitignore
echo __Previews>>.gitignore
echo History>>.gitignore
echo Project Outputs *>>.gitignore
echo * Logs *>>.gitignore
git config --global user.email "r****n@gmail.com"
git config --global user.name "R** F****"
curl -u r***F:p*****d https://api.github.com/user/repos -d "{\"name\":\"%name%\",\"private\":true}"
git init
git add .
git commit -m "Initial commit"
git remote add origin git@github.com:r***F/%name%.git
git push -u origin master
注意:名称显然不包含“*”符号,这只是为了模糊我的细节。
【问题讨论】:
标签: authentication github ssh push