N_Spen
N_Spen

Reputation: 61

Accessing commit history from github via terminal?

Need some quick help. Novice terminal user here. Trying to use these instructions: https://developer.github.com/v3/repos/statistics/#commit-activity to get commit history for a specific user.

However, I don't know what to do with this:

GET /repos/:owner/:repo/stats/contributors

When I replace the owner and repo with the specific names i'm using, nothing happens because I get this error in my terminal:

-bash: GET: command not found

This is a very time sensitive issue, help! Thanks!

Upvotes: 3

Views: 1093

Answers (1)

VonC
VonC

Reputation: 1326994

You can follow this curl tutorial using GitHub's API to see how you would translate

GET /repos/:owner/:repo/stats/contributors

As you notice in the comments, the ":" shouldn't be included.

curl --include https://api.github.com/users/caspyin

Pass user credential to basic auth to access protected resources like a users starred gists, or private info associated with their profile

curl --user "caspyin:PASSWD" https://api.github.com/gists/starred
curl --user "caspyin:PASSWD" https://api.github.com/users/caspyin

Passing just the username without the colon (:) will cause you to be prompted for your account password.
This avoids having your password in your command line history

curl --user "caspyin" https://api.github.com/users/caspyin

In your case, replacing <owner> and <reponame> by the right owner and repo names:

curl https://api.github.com/repos/<owner>/<reponame>/stats/contributors

Upvotes: 3

Related Questions