@jen,
Thanks for the reply.
I used the following code to deploy my site
var settings = {
"url": "https://api.netlify.com/api/v1/sites",
"method": "POST",
"timeout": 0,
"headers": {
"Authorization": "Bearer "+token,
"Content-Type": "application/json"
},
"data": JSON.stringify({"name":sitename,"repo":{"provider":"github","id":305328387,"repo":"Shiva-sandupatla/testrepo","private":false,"branch":"main","deploy_key_id":public_key}}),
};
console.log({"name":sitename,"repo":{"provider":"github","id":305328387,"repo":"Shiva-sandupatla/testrepo","private":true,"branch":"main","deploy_key_id":public_key}});
$.ajax(settings).done(function (response) {
console.log(response);
}).fail(function(e){
console.log(e);
});
In the above code sitename , token and public_key are the variables
When I request, I got success response as below
{"id":"788c169b-799c-4f60-83db-0675bf9d0a7b","site_id":"788c169b-799c-4f60-83db-0675bf9d0a7b","plan":"nf_team_dev","ssl_plan":null,"premium":false,"claimed":true,"name":"dddddddd","custom_domain":null,"domain_aliases":[],"password":null,"notification_email":null,"url":"http://dddddddd.netlify.app","admin_url":"https://app.netlify.com/sites/dddddddd","deploy_id":"","build_id":"5f95155f9026889226bdd1c2","deploy_url":"http://5f9515609026889226bdd1c8--dddddddd.netlify.app","state":"current","screenshot_url":null,"created_at":"2020-10-25T06:04:15.654Z","updated_at":"2020-10-25T06:04:15.713Z","user_id":"5f088353e996d5023cffc741","error_message":null,"ssl":false,"ssl_url":"https://dddddddd.netlify.app","force_ssl":null,"ssl_status":null,"max_domain_aliases":100,"build_settings":{"cmd":null,"dir":null,"env":{},"created_at":"2020-10-25T06:04:15.688Z","updated_at":"2020-10-25T06:04:15.688Z","private_logs":null,"allowed_branches":["main"],"functions_dir":null,"installation_id":null,"skip_prs":null,"untrusted_flow":"review","base_rel_dir":true,"stop_builds":false,"public_repo":true,"provider":"github","repo_type":"git","repo_url":"https://github.com/Shiva-sandupatla/testrepo","repo_branch":"main","repo_path":"Shiva-sandupatla/testrepo","base":null,"deploy_key_id":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDPWw2IqbvzVH2c+J5pY5xIaVZz2SrCtIbfwRSfNu87YIivGtsabN4SRjkyDC4mias8Uc7IIj0c7jDiXX0cAzrILbQQNPPoQeaSb+gOZkYkeeM7dD4UlAPQepT6LBMWZSbQS3+3v+TcyWu501rh4Gn/xoyE5QVE8tQRtHWitfdOw5woMuPO49ZIBlIsociSXvEoGn25W53Jc47nG+TcNoDYbnrsOFDNbJWAoixhd3YeS1N3jiZxU1z9imqf/JZ9RuzWNy91KcT2s6Eg4BjD4umzK1L3liISXdHXUKBzWkurL9+CQTH6lI46F29wbolsInPBL4HeMF8bDxOFh6rjo7KlAYERI0JMkISUm9XByn0t3QGy32BsM6erW8gYYQPlsJnZCjFSz8N5UFJpWXshEErcLKwkC/DC5hEGir2mROXHn8lhowpiOSpYeZtKx4LRdTbp5CUZgD+hIWxnyXyviQKalpXS8z3x2P1wsw9sj/0HTTgMM1scvcZd/nl4HdvYm6FT5ct1pi9vqht1HGaTu3s4QXm+DEyLKg/oIpO6JLbQ5L3mM8q2GD9xyHGdseGcu54/ddtl/O+Hh1Rmz4Uu+ZHRM9K+O1wTuNKXYDyMiI2yLUv9RAV0ZUvhYWKO1j8IYePlyHJPDniZe6gUXfisO2xV+oVPA1yuzEy4K6rvo0Q+fQ=="},"processing_settings":{"css":{"bundle":true,"minify":true},"js":{"bundle":true,"minify":true},"images":{"optimize":true},"html":{"pretty_urls":true},"skip":true,"ignore_html_forms":false},"prerender":null,"prerender_headers":null,"deploy_hook":"https://api.netlify.com/hooks/github","published_deploy":null,"managed_dns":true,"jwt_secret":null,"jwt_roles_path":"app_metadata.authorization.roles","account_slug":"shiva-team","account_name":"Shiva","account_type":"Starter","capabilities":{"title":"Netlify Team Free","asset_acceleration":true,"form_processing":true,"cdn_propagation":"partial","build_node_pool":"buildbot-external-ssd","domain_aliases":true,"secure_site":false,"prerendering":true,"proxying":true,"ssl":"custom","rate_cents":0,"yearly_rate_cents":0,"ipv6_domain":"cdn.makerloop.com","branch_deploy":true,"managed_dns":true,"geo_ip":true,"split_testing":true,"id":"nf_team_dev","cdn_tier":"reg"},"dns_zone_id":null,"identity_instance_id":null,"use_functions":null,"use_edge_handlers":null,"parent_user_id":null,"automatic_tls_provisioning":null,"disabled":null,"lifecycle_state":"active","id_domain":"788c169b-799c-4f60-83db-0675bf9d0a7b.netlify.app","use_lm":null,"build_image":"xenial","automatic_tls_provisioning_expired":false,"analytics_instance_id":null,"functions_region":null,"functions_config":{"site_created_at":"2020-10-25T06:04:15.654Z"},"plugins":[],"default_domain":"dddddddd.netlify.app"}
But when i open my dashboard in the website it says deployment failed.
Here is the deploy log:
11:45:07 AM: Build ready to start
11:45:08 AM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
11:45:08 AM: build-image tag: v3.4.1
11:45:08 AM: buildbot version: 0a44c930054be748eff0c581d346282fece89cc0
11:45:08 AM: Fetching cached dependencies
11:45:08 AM: Failed to fetch cache, continuing with build
11:45:08 AM: Starting to prepare the repo for build
11:45:09 AM: User git error while checking for ref refs/heads/main
11:45:09 AM: Failing build: Failed to prepare repo
11:45:09 AM: Failed during stage 'preparing repo': error checking for ref: fatal: could not read Username for 'https://github.com': No such device or address: exit status 128
11:45:09 AM: Finished processing build request in 677.152865ms
Hoping with a positive response.
Regards, shiva.