We're having issues writing to a repository using our Github API Token, probably because what we're trying to achieve isn't possible. If it isn't feasible then I would like an explanation of why we can't perform the following:
We would want to avoid the Web Application Flow because what we want deems simple. Ideally we would like to use our API token like this:
Following this guide: https://github.com/blog/1270-easier-builds-and-deployments-using-git-over-https-and-oauth If we scroll to the very bottom of "Using OAuth with Git", we will see:
To avoid writing tokens to disk, don't clone. Instead, just use the full git URL in your push/pull operations
As the doc states, we would like to perform push/pull operations. An example pull operation would be:
mkdir foo
cd foo
git init
git pull https://<token>@github.com/username/bar.git
Now we would want to perform a push operation (ie: something like below, as the documentation implies)
git add file
git commit file -m "Changed file"
git push https://<token>@github.com/username/bar.git master
The problem we're running into is on the push phase; we are stuck in performing the push operation. The error we receive is:
fatal: Authentication failed
What are we missing? All we want is for the service account to perform push/pull operations via the documentation I provided above. The service account has been added (with read/write access) to our organization.
Points worth mentioning:
- Our API token has "scope: repo" access.
- This example is from a Github Enterprise account.