I was trying to create new repo and then commit files to that repo.
Creating repo is ok but I got an error "409 Git Repository is empty.", when I try to commit file to that repo.
Can't we commit to new repo? Or is there any way to do empty commit by using go-github?
Hi @htetmyomyint :
Hope you are doing well !
If you question is generic and not related with this project/repo, then you can do a empty commit by below:
git commit --allow-empty -m 'Your commit message'
If you question is related with creating a copy of go-github repository and performing commits, then probably you need to do below set of steps:
go get github.com/dreamer-89/go-githubgit clone [email protected]:dreamer-89/go-github.gitFor details on contributing on this repo, please check below:
https://github.com/google/go-github/blob/master/CONTRIBUTING.md
Please let me know if it was helpful and feel free to ask again.
@dreamer-89
I am sorry that my question is unclear. Actually, I want to write a program( by using go-github api ) that can create repo and commit files to that created repo. But I've got an error( 409 Git repository is empty ). So, I want to know how should I solve or I want to get reference links for solving the problem.
We need to clarify a few things here.
If you want to interact with GitHub via the GitHub Developers v3 API, then you will most likely want to use this package.
If, however, all you want to do is locally create a git repo and commit files to that repo from Go, then you have a couple options:
git init, git add, git commit, git push, etc. CLI commands directly from Go using the exec package, orIf you do indeed want to interact with the GitHub Developers v3 API, then take a look at our examples directory for some hints.
If you still need help, then please post a short example of the code you are trying to run (without any access tokens, of course) and we will try and help you identify the problem and get it working.
@gmlewis
Thank you. Now I understand that I should set the required values (according to go-github's Repository struct) to get the desired result.
Hi i am facing isssue in github the repository is empty can anyone help me ..?
"We couldn鈥檛 access the repository Abbas798/site2. This could be because the repository is empty or disabled. "
@Abbas798 - please contact GitHub technical support to access your empty or disabled repo.
This repo is a Go client library to access the GitHub v3 API developed and maintained by volunteers.
Most helpful comment
We need to clarify a few things here.
If you want to interact with GitHub via the GitHub Developers v3 API, then you will most likely want to use this package.
If, however, all you want to do is locally create a git repo and commit files to that repo from Go, then you have a couple options:
git init,git add,git commit,git push, etc. CLI commands directly from Go using theexecpackage, orIf you do indeed want to interact with the GitHub Developers v3 API, then take a look at our
examplesdirectory for some hints.If you still need help, then please post a short example of the code you are trying to run (without any access tokens, of course) and we will try and help you identify the problem and get it working.