Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7062791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:38:11+00:00 2026-05-28T04:38:11+00:00

Alright, here’s what I’m trying to do. I’m attempting to write a quick build

  • 0

Alright, here’s what I’m trying to do. I’m attempting to write a quick build script in bash that will check out a private repository from GitHub on a remote server. To do this a “hands off” as possible, I want to generate a local RSA key set on the remote server and add the public key as a Deploy Key for that particular repository. I know how to do this using GitHub’s API, but I’m having trouble building the JSON payload using Bash.

So far, I have this particular process included below:

#!/bin/bash

ssh-keygen -t rsa -N '' -f ~/.ssh/keyname -q
public_key=`cat ~/.ssh/keyname.pub`

curl -u 'username:password' -d '{"title":"Test Deploy Key", "key":"'$public_key'"}' -i https://api.github.com/repos/username/repository/keys

It’s just not properly building the payload. I’m not an expert when it comes to string manipulation in Bash, so I could seriously use some assistance. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:38:12+00:00Added an answer on May 28, 2026 at 4:38 am

    It’s not certain, but it may help to quote where you use public_key, i.e.

    curl -u 'username:password' \
       -d '{"title":"Test Deploy Key", "key":"'"$public_key"'"}' \
       -i https://api.github.com/repos/username/repository/keys
    

    Otherwise it will be much easier to debug if you use the shell’s debugging options set -vx near the top of your bash script.

    You’ll see each line of code (or block (for, while, etc) as it is in your file. Then you see each line of code with the variables expanded to their values.

    If you’re still stuck, edit your post to show the expanded values of variables for the problem line in your script. What you have looks reasonable at first glance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, so here's my problem. I'm trying to write a script in PHP that
Alright so here is my issue. I'm working a game engine that will eventually
Alright so here is the deal. I am trying to make a application that's
Alright, here we go! I am currently developing an iPhone app that will work
Alright, currently I have my SWF hitting a php file that will go and
Alright here is what I am attempting to do. I have a form written
I'm trying to generate ics-files, see sample here: http://deap.nu/myprogram.ics It validates alright here: https://icalendar.org/validator.html
Alright, here is my problem i'm trying to solve. I have an index page
Alright, here's a quick explanation of what I am doing: I have a website
Alright, here's my dillema. I am making a simple application with Qt Creator that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.