恐龙什么时候灭绝的| 属鼠是什么命| 糖醋里脊是什么肉做的| 胸外科主要看什么病| 高压偏低有什么危害| 素女经是什么| 防空警报是什么| 有眼袋是什么原因| 有朝一日是什么生肖| 十年是什么婚| blm是什么意思| 总钙是什么意思| 住院需要带什么生活用品| 尾骨疼是什么原因| 抑郁到什么程度要吃氟西汀| 挑食是什么意思| 舌尖麻是什么原因| 神经酸是什么| 狗能吃什么| 眼疖子用什么药| 吃什么变碱性体质最快| 手掌很红是什么原因| pa环是什么| 蒲公英什么时候采最好| 春天有什么水果| 姨妈期间吃什么水果| 什么笑容| sorona是什么面料| 马齿苋长什么样| 时隔是什么意思| 哺乳期感冒吃什么药| 2016属什么生肖| 什么花是白色的| 白狐寓意着什么| 门良念什么| 大米里放什么不生虫子| 码是什么单位| 什么叫强直性脊柱炎| 走麦城是什么意思| 三七植物长什么样子| 缺营养吃什么补身体最好| 心脏超声检查是什么| 男生适合学什么专业| 房速与房颤有什么区别| 李莫愁的徒弟叫什么| 什么物流寄大件便宜| 人参泡酒有什么功效| 吃什么中药能降血压| 堪舆是什么意思| 气压是什么| 师团长是什么级别| 月光像什么| 1956年属什么| 吃什么能缓解孕吐| 茯苓是什么东西| 临兵斗者皆阵列在前什么意思| 双字五行属什么| 小海绵的真名叫什么| 神疲乏力是什么症状| 儿童经常流鼻血什么原因造成的| 健身后应该吃什么| 什么东西最好吃| 伤寒是什么病| 宝宝发烧手脚冰凉是什么原因| 甲沟炎用什么药好| 下巴肿大是什么原因| 拉格啤酒是什么意思| 下午一点到三点是什么时辰| 为什么要打肝素| 十二指肠溃疡吃什么药| 胯骨疼是什么原因| 昆仑山在什么地方| 猫和狗为什么是天敌| 吹喇叭什么意思| ein是什么意思| 摄取是什么意思| 什么牌子的益生菌调理肠胃比较好| pbs是什么| 帕金森是什么引起的| 34岁属什么的生肖| 肝癌是什么原因引起的| 长血痣是什么原因| 凌晨三点半是什么时辰| 下半年有什么节日| 绿茶婊是什么意思| 李世民的字是什么| 淋巴结是什么病严重吗| 沙眼是什么原因引起的| 为什么不建议切除脂肪瘤| 4月3日什么星座| 脚踝水肿是什么原因| 尿生化是查什么的| omega什么牌子手表| 右后背疼是什么病| 梦见孩子拉屎是什么意思| 犯太岁是什么意思| davena手表什么牌子| 辛辣都包括什么| hbsag阳性什么意思| 心肌供血不足吃什么| 什么地方| 肝钙化灶什么意思| 为什么做着做着就软了| 乳腺增生不能吃什么| 排卵期身体有什么症状表现吗| 士官是什么级别| 锲而不舍下一句是什么| 4月17日是什么星座| 什么是阿尔茨海默症| 胃酸吃什么药效果最好| 早餐有什么| 老炮儿是什么意思啊| 怼人是什么意思| 左什么右什么| 为什么叫客家人| 晚上睡不着觉吃什么药| 上海市市委书记是什么级别| 蓝莓什么时候成熟| 小辣椒是什么意思| lmy是什么意思| 不到长城非好汉的下一句是什么| 雪媚娘是什么| 用激素药有什么副作用| 四五月份是什么星座| 中央候补委员什么级别| 毕业典礼送什么花| 祭祀什么意思| 农历十月初八是什么星座| 眼睛流泪是什么原因| 女性排卵期有什么表现| 脸痒痒是什么原因| 菊花有什么功效和作用| 11月9号是什么星座| 感康是什么药| 薷是什么意思| 血液粘稠是什么原因| 生育登记有什么用| 打劫是什么意思| 感冒了可以吃什么水果| 产后第一次来月经是什么颜色| 晕车喝什么饮料| 里急后重吃什么药| 易岗易薪是什么意思| 血糖吃什么水果| 24岁属什么| 三伏天是什么| 神经损伤吃什么药最好| 什么春什么什么| 梦见头发长长了是什么意思| 情趣什么意思| 地级市市长什么级别| 头不舒服是什么原因| dpl是什么意思| 什么食物含叶酸多| 宫内妊娠是什么意思| 男人好难做人好难是什么歌| 孕妇建档需要什么资料| 猫咪能看到什么颜色| 吃酒酿有什么好处| 胎儿永存左上腔静脉是什么意思| 肚脐眼臭是什么原因| 再三的意思是什么| 热敷肚子有什么好处| 参军意愿选什么比较好| 羊肉和什么菜搭配最好| 七月二十六是什么星座| 什么的饰品| 心肝血虚吃什么中成药| 好整以暇什么意思| 淼念什么| 大便次数少是什么原因| 至死不渝下一句是什么| 肝阳上亢是什么意思| 药师什么时候报名| 泰迪狗长什么样子| hvr是什么意思| 手脱皮是什么原因| 一线炎是什么病严重吗| 腋下出汗有异味是什么原因| 风油精有什么功效| 长期手淫会有什么危害| 什么时候夏至| 颇有是什么意思| 经常不吃晚饭对身体有什么影响| cosplay是什么意思| 登对是什么意思| 后羿和嫦娥是什么关系| 常吃山药有什么好处和坏处| 大叔是什么意思| 包皮炎用什么软膏| 月经来头疼是什么原因引起的| 肝不好有什么症状表现| 水瓶后面是什么星座| 泌尿科主要看什么病| 生理是什么意思| 欺世盗名是什么意思| 抗核抗体阴性说明什么| 吃什么水果补肾| 什么牌奶粉好| 窦性心律早期复极是什么意思| 毛囊炎长什么样| 中位数是什么意思| 偶尔是什么意思| 看睾丸去医院挂什么科| 减肥期间可以吃什么零食| 三餐两点什么意思| 黄花菜都凉了什么意思| 双肾小结石是什么意思| 辅警是什么| 肩胛骨麻麻的什么原因| 什么是再生障碍性贫血| 金钱草什么样| 胃疼看病挂什么科| 尿潜血是什么原因| hp是什么意思| 牛仔裤搭配什么衣服好看| 小麦淀粉可以做什么| jessica是什么意思| 9.3号是什么星座| 金克木是什么意思| 后背容易出汗是什么原因| 尿频尿多吃什么药好| 芹菜和什么不能一起吃| 薰衣草什么时候开花| 球镜是什么意思| 割包皮有什么用| 白细胞和淋巴细胞偏高是什么原因| 谁发明了什么| 1962年属虎的是什么命| 什么是央企| 农历六月六日是什么节日| 腋臭是什么原因引起的| 狐臭用什么药| 红豆和什么一起煮比较好| 胃属于什么科室| 喜悦之情溢于言表什么意思| 什么馅饺子好吃| 胸口疼挂什么科| 嘴巴干苦是什么原因| 不什么下什么的成语| 富三代是什么意思| vg是什么意思| 安眠药有什么副作用| 广西北海有什么好玩的地方| 鼓上蚤是什么意思| 惊艳了时光温柔了岁月什么意思| 70岁是什么之年| 1935年属什么| 什么是水印照片| 痰栓是什么| 肺气肿是什么病严重吗| 金乐什么字| 脾肾阳虚吃什么药| 什么叫精索静脉曲张啊| 11月16是什么星座| 脊髓灰质炎是什么病| 中国的国球是什么球| 网名叫什么好听| 献血之后吃什么比较好| 人体最大的排毒器官是什么| 移徙是什么意思| 佛性是什么意思| 心绪不宁的意思是什么| 26是什么意思| 百度
Skip to main content

用车有人晓得伐 汽车热车不能启动怎么处理?

百度 希望通过“两宋论坛”的举办,不断提升学术影响,并拓展活动项目,有效转化论坛成果,打造一个精彩纷呈的论坛品牌。

Learn different ways to manage SSH keys on your servers when you automate deployment scripts and which way is best for you.

You can manage SSH keys on your servers when automating deployment scripts using SSH agent forwarding, HTTPS with OAuth tokens, deploy keys, or machine users.

SSH agent forwarding

In many cases, especially in the beginning of a project, SSH agent forwarding is the quickest and simplest method to use. Agent forwarding uses the same SSH keys that your local development computer uses.

Pros of SSH agent forwarding

  • You do not have to generate or keep track of any new keys.
  • There is no key management; users have the same permissions on the server that they do locally.
  • No keys are stored on the server, so in case the server is compromised, you don't need to hunt down and remove the compromised keys.

Cons of SSH agent forwarding

  • Users must SSH in to deploy; automated deploy processes can't be used.
  • SSH agent forwarding can be troublesome to run for Windows users.

Set up SSH agent forwarding

  1. Turn on agent forwarding locally. See our guide on SSH agent forwarding for more information.
  2. Set your deploy scripts to use agent forwarding. For example, on a bash script, enabling agent forwarding would look something like this: ssh -A serverA 'bash -s' < deploy.sh

HTTPS cloning with OAuth tokens

If you don't want to use SSH keys, you can use HTTPS with OAuth tokens.

Pros of HTTPS cloning with OAuth tokens

  • Anyone with access to the server can deploy the repository.
  • Users don't have to change their local SSH settings.
  • Multiple tokens (one for each user) are not needed; one token per server is enough.
  • A token can be revoked at any time, turning it essentially into a one-use password.

Cons of HTTPS cloning with OAuth tokens

  • You must make sure that you configure your token with the correct access scopes.
  • Tokens are essentially passwords, and must be protected the same way.

Set up HTTPS cloning with OAuth tokens

See our guide on creating a personal access token.

Deploy keys

You can launch projects from a repository on GitHub.com to your server by using a deploy key, which is an SSH key that grants access to a single repository. GitHub attaches the public part of the key directly to your repository instead of a personal account, and the private part of the key remains on your server. For more information, see Delivering deployments.

Deploy keys with write access can perform the same actions as an organization member with admin access, or a collaborator on a personal repository. For more information, see Repository roles for an organization and Permission levels for a personal account repository.

For enhanced security and fine-grained control over repository access and permissions, we recommend using a GitHub App instead. See Deciding when to build a GitHub App.

Pros of deploy keys

  • Anyone with access to the repository and server has the ability to deploy the project.
  • Users don't have to change their local SSH settings.
  • Deploy keys are read-only by default, but you can give them write access when adding them to a repository.

Cons of deploy keys

  • Deploy keys only grant access to a single repository. More complex projects may have many repositories to pull to the same server.
  • Deploy keys are usually not protected by a passphrase, making the key easily accessible if the server is compromised.
  • Deploy keys are credentials that don't have an expiry date.
  • Deploy keys aren't linked directly to organization membership. If the user who created the deploy key is removed from the repository, the deploy key will still be active as it isn't tied to the specific user, but rather to the repository.

Set up deploy keys

  1. Run the ssh-keygen procedure on your server, and remember where you save the generated public and private rsa key pair.

  2. On GitHub, navigate to the main page of the repository.

  3. Under your repository name, click Settings. If you cannot see the "Settings" tab, select the dropdown menu, then click Settings.

    Screenshot of a repository header showing the tabs. The "Settings" tab is highlighted by a dark orange outline.

  4. In the sidebar, click Deploy Keys.

  5. Click Add deploy key.

  6. In the "Title" field, provide a title.

  7. In the "Key" field, paste your public key.

  8. Select Allow write access if you want this key to have write access to the repository. A deploy key with write access lets a deployment push to the repository.

  9. Click Add key.

You can also use the REST API to create deploy keys. For more information, see REST API endpoints for deploy keys.

Using multiple repositories on one server

If you use multiple repositories on one server, you will need to generate a dedicated key pair for each one. You can't reuse a deploy key for multiple repositories.

In the server's SSH configuration file (usually ~/.ssh/config), add an alias entry for each repository. For example:

Host github.com-repo-0
        Hostname github.com
        IdentityFile=/home/user/.ssh/repo-0_deploy_key

Host github.com-repo-1
        Hostname github.com
        IdentityFile=/home/user/.ssh/repo-1_deploy_key
  • Host github.com-repo-0 - The repository's alias.
  • Hostname github.com - Configures the hostname to use with the alias.
  • IdentityFile=/home/user/.ssh/repo-0_deploy_key - Assigns a private key to the alias.

You can then use the hostname's alias to interact with the repository using SSH, which will use the unique deploy key assigned to that alias. For example:

git clone git@github.com-repo-1:OWNER/repo-1.git

GitHub App installation access tokens

If your server needs to access repositories across one or more organizations, you can use a GitHub App to define the access you need, and then generate tightly-scoped, installation access tokens from that GitHub App. The installation access tokens can be scoped to single or multiple repositories, and can have fine-grained permissions. For example, you can generate a token with read-only access to a repository's contents.

Since GitHub Apps are a first class actor on GitHub, the installation access tokens are decoupled from any GitHub user, which makes them comparable to "service tokens". Additionally, installation access tokens have dedicated rate limits that scale with the size of the organizations that they act upon. For more information, see Rate limits for GitHub Apps.

Pros of installation access tokens

  • Tightly-scoped tokens with well-defined permission sets and expiration times (1 hour, or less if revoked manually using the API)
  • Dedicated rate limits that grow with your organization
  • Decoupled from GitHub user identities, so they do not consume any licensed seats
  • Never granted a password, so cannot be directly signed in to

Cons of installation access tokens

  • Additional setup is needed to create the GitHub App.
  • Installation access tokens expire after 1 hour, and so need to be re-generated, typically on-demand using code.

Set up installation access tokens

  1. Determine if your GitHub App should be public or private. If your GitHub App will only act on repositories within your organization, you likely want it private.
  2. Determine the permissions your GitHub App requires, such as read-only access to repository contents.
  3. Create your GitHub App via your organization's settings page. For more information, see Creating a GitHub App.
  4. Note your GitHub App id.
  5. Generate and download your GitHub App's private key, and store this safely. For more information, see Generating a private key.
  6. Install your GitHub App on the repositories it needs to act upon, optionally you may install the GitHub App on all repositories in your organization.
  7. Identify the installation_id that represents the connection between your GitHub App and the organization repositories it can access. Each GitHub App and organization pair have at most a single installation_id. You can identify this installation_id via Get an organization installation for the authenticated app. This requires authenticating as a GitHub App using a JWT, for more information see Authenticating as a GitHub App.
  8. Generate an installation access token using the corresponding REST API endpoint, Create an installation access token for an app. This requires authenticating as a GitHub App using a JWT, for more information see Authenticating as a GitHub App, and Authenticating as an installation.
  9. Use this installation access token to interact with your repositories, either via the REST or GraphQL APIs, or via a Git client.

For more information, see Generating an installation access token for a GitHub App.

Machine users

If your server needs to access multiple repositories, you can create a new account on GitHub.com and attach an SSH key that will be used exclusively for automation. Since this account on GitHub.com won't be used by a human, it's called a machine user. You can add the machine user as a collaborator on a personal repository (granting read and write access), as an outside collaborator on an organization repository (granting read, write, or admin access), or to a team with access to the repositories it needs to automate (granting the permissions of the team).

Tip

Our terms of service state:

Accounts registered by "bots" or other automated methods are not permitted.

This means that you cannot automate the creation of accounts. But if you want to create a single machine user for automating tasks such as deploy scripts in your project or organization, that is totally cool.

Pros of machine users

  • Anyone with access to the repository and server has the ability to deploy the project.
  • No (human) users need to change their local SSH settings.
  • Multiple keys are not needed; one per server is adequate.

Cons of machine users

  • Only organizations can restrict machine users to read-only access. Personal repositories always grant collaborators read/write access.
  • Machine user keys, like deploy keys, are usually not protected by a passphrase.

Set up machine users

  1. Run the ssh-keygen procedure on your server and attach the public key to the machine user account.
  2. Give the machine user account access to the repositories you want to automate. You can do this by adding the account as a collaborator, as an outside collaborator, or to a team in an organization.

Further reading

夏季吃桃子有什么好处 长脸适合什么发型 不可多得是什么意思 植物园有什么植物 心脏是什么形状
晚上睡觉出汗是什么原因 得了性疾病有什么症状 为什么会得近视眼 胎儿头偏小是什么原因引起的 疤痕修复用什么药膏好
女人平胸是什么原因 夫妻肺片里面都有什么 pd是什么意思 肠胃不好吃什么药 维生素d是什么东西
婴儿喝什么牌奶粉好 胸骨疼挂什么科 误食干燥剂有什么危害 白细胞高是什么原因造成的 什么人不能喝牛奶
乌合之众是什么意思wzqsfys.com 9年是什么婚huizhijixie.com 剂量是什么意思hcv8jop5ns1r.cn 核磁是检查什么的hcv8jop0ns2r.cn 硫磺是什么hcv7jop6ns3r.cn
3月12日什么星座youbangsi.com 血压高吃什么菜和水果能降血压hcv9jop7ns4r.cn 医保定点是什么意思hcv9jop4ns4r.cn 胃炎挂什么科hcv7jop5ns6r.cn m蛋白是什么hcv7jop7ns0r.cn
五官立体是什么意思hcv9jop1ns5r.cn 三醋酯纤维是什么面料hcv8jop2ns5r.cn 霍乱时期的爱情讲的是什么hcv7jop4ns8r.cn 蝙蝠吃什么食物hcv8jop9ns8r.cn 处暑什么意思hcv8jop6ns4r.cn
2月25日是什么星座hcv8jop9ns6r.cn 便秘屁多是什么原因hcv8jop9ns9r.cn 舌根起泡是什么原因hcv9jop2ns3r.cn 蜈蚣怕什么hcv8jop6ns9r.cn 姓袁女孩叫什么名字好听fenrenren.com
百度