首页 > 解决方案 > 自动从github克隆到ubuntu

问题描述

我正在尝试使用 shell 脚本自动从 github 克隆到 ubuntu,我遇到了一个问题:

在 git clone "repos..." 之后,我们必须添加用户名和用户名密码。

如果我有一个 shell 脚本:

#!/bin/bash
echo AutoClone From github
echo ===================================================
git clone "repos..."
# here i need to add something that add username and password automatically when git clone was applied.
done

真实例子:

root@localhost:~# git clone https://github.com/....
root@localhost:~# git clone https://github.com/...
Cloning into 'NewFrontEnd'...
Username for 'https://github.com':

用户名也必须在 shell 脚本中并自动添加。

标签: bashgitshellubuntugithub

解决方案


在这种情况下,听起来 Tcl/expect 脚本更适合您。或者设置您的 SSH 密钥以克隆存储库,而无需输入您的用户名和密码。


推荐阅读