I have been trying to write an script to backup my repos at Bitbucket using the paged feature of the REST API. Here, the code I wrote.
#!/bin/bash echo -n "Username: "; read username; echo -n "Password: "; read -s password echo rm -f repos for page in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 do curl --user ${username}:${password} https://api.bitbucket.org/2.0/repositories/${username}?page=${page}\&role=contributor | grep -o '"ssh:[^ ,]\+' | xargs -L1 echo >> repos done cat repos | xargs -L1 git clone exit 0;
However, I can only fetch my own repos but not those one where I am a contributor and I don't own. Observe that I tried to use role=contributor but it seems to be ignored.
Any ideas?