简体   繁体   中英

git pull/clone private repo using bash script only

I am new to github and bash scripting, so help will be appreciated.

I want to run a script that will clone a private github repo into my instance. Since the repo is private, I understand that I need to do this through ssh. So my script starts like this:

#!/bin/sh
ssh-keygen -t rsa
#HOW DO I ADD THE SSH TO GITHUB FROM THIS SCRIPT
git clone git@github.com:user/repo.git

However the next step is that I need to manually go into github in order to add the SSH key into my settings. Is there anyway I can do all of this through the script itself?

Thanks

为此,您需要授权您的脚本使用GitHub API,并通过curl或某种类型的相应方法添加新生成的公钥。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM