ssh [email protected] info
The above ssh call will connect to a Git hosting server that has gitolite installed and will return the list of repositories that are available to your account along with the access rights of each.
Note: This command should work even if remote login via ssh is blocked on the server.
The command should return a list similar to this:
hello bytefreaks, this is git@git running gitolite3 v3.5.3.1-1-gf8776f5 on git 1.7.1 R W Repo1 R W Repo2 R W Repo3 R Repo4
The first column in the results is the read flag, the second the write flag and the third column is the name of the repository.
In order to clone (get a local copy) a repository from the above list (for the example lets use Repo1) you have to issue the following command
git clone ssh://[email protected]/Repo1
To clone all of the repositories in the current directory with one command, as it is shown in this guide, issue the following command:
ssh [email protected] info | cut -f 2 | tail -n +3 | xargs -I {} -n 1 git clone ssh://[email protected]/{}
This post is also available in: Greek
You assumed there is gitolite installed. Try to achieve the same without gitolite in place – I do not think it is possible.
That is correct.
What kind of configuration are you referring to for your server?
Hi, I am trying to use ‘ssh’ to list all available repositories on a git server. I used same command given on this page, but i get error:
$ ssh [email protected]
PTY allocation request failed on channel 0
logged in as ashviniPtech.
You can use git or hg to connect to Bitbucket. Shell access is disabled.
Connection to bitbucket.org closed.
ashvini.joshi@INPUN-L002 MINGW64 /f/1st_Dec_2015_rejoining/GitHub-Work/myfirstrepository (master)
Seeing this message I understand that Shell Access is not provided by git server admin. I checked few options for enabling shell access, however could not understand much.
Can you help me in listing all repositories on git server on my local machine(currently using Windows 7) via SSH?
Thanks
Hello!
I believe the ssh command for bitbucket is used only to allow you to check that you have properly configured your Key.
Try the second code from following the following guide:
http://bytefreaks.net/gnulinux/bash/bitbucket-org-clone-all-repositories-of-your-account
It will give you the full ssh path for each repository. One per line.
All you have to do is replace the
of the command with your username which will become
Hello
I tried this command, I guess regEx is not correct here:
$ curl –user ashviniPtech https://api.bitbucket.org/2.0/repositories/ashviniPtech | grep -o ‘”ssh:[^ ,]\+’ | xargs -L1 echo
grep: Invalid regular expression
🙁
Use the code from here (http://bytefreaks.net/gnulinux/bash/bitbucket-org-clone-all-repositories-of-your-account) to copy-paste .
Wordpress replaced the quotes character with another, that is why you get the error.
You need to take swap out the formatting of the apostrophe and quotes with your terminal font.
I am able to run this command, but I only get 10 results. It appears the default page length is 10. But I have hundreds of repositories on about 8 pages. How can I get results for all of it?
Hello 🙂
First of all thank you for helping out with the issue of “Ashvini Joshi” .
Second, bitbucket has pagination on this query (https://confluence.atlassian.com/bitbucket/version-2-423626329.html#Version2-Pagingthroughobjectcollections).
You have two options at this point:
a) Either make the first call and then follow the links marked in the “next” field
b) or increase the page length size to something bigger (e.g https://api.bitbucket.org/2.0/repositories?pagelen=100) .
In your case, you know the expected length of the response, so try setting the pagelen value to the length you expect to get and you will get all data in one call.
Caveat: If pagelen is too ‘big’, the server will return an error message instead of the results, so always try to keep pagelen as small as possible.
[BitBucket.org] Clone all repositories of your account
http://bytefreaks.net/gnulinux/bash/bitbucket-org-clone-all-repositories-of-your-account
[GitLab.com] Clone all repositories in your account
http://bytefreaks.net/gnulinux/bash/gitlab-com-clone-all-repositories-in-your-account
Pingback: Post Exploitation through Git with SSH Keys
Pingback: Post Exploitation through Git with SSH Keys
Pingback: Post Exploitation through Git with SSH Keys – Wya.pl