Hi there,
i need assistant to understand where i am going wrong. Basically i am trying to develop a shell script that create a REPO on bitbucket cloud and then configured the same repo with git. But am facing problem in doing so.
Below the curl command which i was using. This command was working fine and creating a new repo on the BitBucket cloud account.
curl -X POST -v -u 'XXXXXX@gmail.com':'MY_PASSWORD' -H "Content-Type: application/json" \ https://api.bitbucket.org/2.0/repositories/weqwebsites/${REPO_NAME} \ -d '{"scm": "git", "is_private": "true", "fork_policy": "no_public_forks" }' Now i have configured SSH keys with bitbucket account to use the git remote add origin command. After using ssh key the above command is not working for me. I had configured SSH so that i dont need to manually type the password and my shell script can ran independently.
Error which i am getting.
* About to connect() to api.bitbucket.org port 443 (#0)
* Trying 18.205.93.8...
* Connected to api.bitbucket.org (18.205.93.8) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSL connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=*.bitbucket.org,OU=Bitbucket,O="Atlassian, Inc.",L=San Francisco,ST=California,C=US
* start date: Jun 12 00:00:00 2017 GMT
* expire date: Jun 16 12:00:00 2020 GMT
* common name: *.bitbucket.org
* issuer: CN=DigiCert SHA2 High Assurance Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US
* Server auth using Basic with user 'XXXXX@gmail.com'
> POST /2.0/repositories/weqwebsites/ HTTP/1.1
------REMOVED THE AUTH LINE FOR SECURING MY ACCOUNT------
> User-Agent: curl/7.29.0
> Host: api.bitbucket.org
> Accept: */*
> Content-Type: application/json
> Content-Length: 71
>
* upload completely sent off: 71 out of 71 bytes
< HTTP/1.1 405 Method Not Allowed
< Server: nginx
< Vary: Authorization
< Content-Type: text/html; charset=utf-8
< Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
< Date: Sun, 22 Mar 2020 20:02:04 GMT
< X-Served-By: app-1130
< X-Static-Version: b26e4d56649f
< X-Credential-Type: password
< X-Render-Time: 0.0173208713531
< Connection: Keep-Alive
< X-Version: b26e4d56649f
< X-Request-Count: 1216
< Allow: GET
< X-Frame-Options: SAMEORIGIN
< Content-Length: 0
<
* Connection #0 to host api.bitbucket.org left intact
Complete Code block in sequence of their execution given below:
curl -X POST -v -u 'XXXXXX@gmail.com':'MY_PASSWORD' -H "Content-Type: application/json" \ https://api.bitbucket.org/2.0/repositories/weqwebsites/${REPO_NAME} \ -d '{"scm": "git", "is_private": "true", "fork_policy": "no_public_forks" }'
git init >> ${LOG}
git add * >> ${LOG}
git commit -m 'First Commit $DATE' >> ${LOG}
git remote add origin ssh://git@bitbucket.org/weqwebsites/${REPO_NAME}.git >> ${LOG}
git push origin master >> ${LOG}