PLEASE help us help you by writing a good post!
- we need to know your netlify site name. Example:
gifted-antelope-58b104.netlify.app
- DNS issues? Tell us the custom domain, tell us the error message! We can’t help if we don’t know your domain.
- Build problems? Link or paste the FULL build log & build settings screenshot
The better the post - the faster the answer.
I am creating a website using the API and linking a Github repo at the same time. Here’s the payload I am sending
data = {
"name": name,
"repo": {
"branch": "master",
"private": True,
"provider": "github",
"repo": f"my_github_account/my_repo_name",
}
}
headers = {"Authorization": "Bearer the_actual_netlify_token"}
response = requests.post("https://api.netlify.com/api/v1/sites", headers=headers, json=data)
print(response.status_code)
# HTTP 201
print(response.json())
Here’s the response I get
{
"id": "d1c545fe-b3c4-4230-8f2c-bcf0626174d5",
"site_id": "d1c545fe-b3c4-4230-8f2c-bcf0626174d5",
"plan": "nf_team_dev",
"ssl_plan": null,
"premium": false,
"claimed": true,
"name": "askdjfiwa20",
"custom_domain": null,
"domain_aliases": [],
"password": null,
"sso_login": false,
"sso_login_context": "all",
"notification_email": null,
"url": "http://askdjfiwa20.netlify.app",
"admin_url": "https://app.netlify.com/sites/askdjfiwa20",
"deploy_id": "",
"build_id": "63a7efcbf5a3690f6663d8fe",
"deploy_url": "http://63a7efccf5a3690f6663d903--askdjfiwa20.netlify.app",
"state": "current",
"screenshot_url": null,
"created_at": "2022-12-25T06:38:03.464Z",
"updated_at": "2022-12-25T06:38:03.656Z",
"user_id": "63939517a9cfed008e5ed4cd",
"error_message": null,
"ssl": false,
"ssl_url": "https://askdjfiwa20.netlify.app",
"force_ssl": null,
"ssl_status": null,
"max_domain_aliases": 100,
"build_settings": {
"cmd": null,
"dir": null,
"env": {},
"created_at": "2022-12-25T06:38:03.650Z",
"updated_at": "2022-12-25T06:38:03.650Z",
"private_logs": null,
"allowed_branches": ["master"],
"functions_dir": null,
"installation_id": null,
"skip_prs": null,
"untrusted_flow": "review",
"base_rel_dir": true,
"stop_builds": false,
"public_repo": false,
"skip_automatic_builds": null,
"provider": "github",
"repo_type": "git",
"repo_url": "https://github.com/sahilklanto/askdjfiwa20",
"repo_branch": "master",
"repo_path": "sahilklanto/askdjfiwa20",
"repo_owner_type": "User",
"base": null,
"deploy_key_id": null
},
"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": "sahil-yz6lmhg",
"account_name": "sahil-yz6lmhg's team",
"account_type": "Starter",
"capabilities": {
"title": "Netlify Team Free",
"asset_acceleration": true,
"form_processing": true,
"cdn_propagation": "partial",
"domain_aliases": true,
"secure_site": false,
"sso_secure_site": false,
"secure_site_context": 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": "d1c545fe-b3c4-4230-8f2c-bcf0626174d5.netlify.app",
"use_lm": null,
"build_image": "focal",
"automatic_tls_provisioning_expired": false,
"analytics_instance_id": null,
"functions_region": null,
"functions_config": {
"site_created_at": "2022-12-25T06:38:03.464Z"
},
"plugins": [],
"account_subdomain": null,
"functions_env": {},
"cdp_enabled": true,
"cdp_enabled_contexts": ["deploy-preview", "branch-deploy"],
"authlify_token_id": null,
"build_timelimit": null,
"use_custom_domain_in_all_contexts": false,
"uses_new_env_var": true,
"deploy_retention_in_days": 90,
"password_context": "all",
"use_envelope": true,
"default_domain": "askdjfiwa20.netlify.app"
}
As you can see the site is created successfully. However when I look at deploys, it gives out this error
Failed during stage 'preparing repo': error checking for ref: : fatal: could not read Username for '[https://github.com](https://github.com/)': No such device or address
Here’s the full log
12:41:59 PM: build-image version: d55944c047ef0aee2ac01971edde72cb2a50acfe (focal)
12:41:59 PM: build-image tag: v4.16.1
12:41:59 PM: buildbot version: 33f88475bcf3426608b49b7681d295235efb41f1
12:41:59 PM: Fetching cached dependencies
12:41:59 PM: Failed to fetch cache, continuing with build
12:41:59 PM: Starting to prepare the repo for build
12:41:59 PM: User git error while checking for ref refs/heads/master
12:41:59 PM: Failing build: Failed to prepare repo
12:41:59 PM: 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
12:41:59 PM: Finished processing build request in 531.873764ms