bash - 自动从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 脚本中并自动添加。
解决方案
在这种情况下,听起来 Tcl/expect 脚本更适合您。或者设置您的 SSH 密钥以克隆存储库,而无需输入您的用户名和密码。
推荐阅读
- python - 我想从 php 运行一个 python 文件。python文件包含很多包(如torch、models等)
- windows - 使用 windows 代理从 teamcity 推送更改到 git 的步骤是什么
- .net-core - MySql.Data 无法连接到 AWS Aurora
- python - Django Filter timestamp data GROUP BY day, week, month, year
- c++ - 为什么 HeapFree() 不能正常工作?
- javascript - 带有 Express 的 NodeJS 4 不会使用 get/post 向服务器发送请求
- django - Django 管理对静态文件 url 的请求
- c - 计算C语言中的字符数
- python - python中的索引错误
- three.js - 使用 Three.js 和 Shader 设计粒子系统