Search code examples
ruby-on-railsgitgithubgit-commitoctokit

Create a new repo and push all the code to created repo using octokit.rb - Rails


Octokit.rb is a Ruby toolkit for the GitHub API. I want to use it to create a new repo and then push my code to that repo. I am able to authenticate user but not able to create a repo. Can someone point me to the right direction, or if anyone knows any better Github api client please tell.


Solution

  • I finally found it myself, it's not present in the docs on github. You will find it here Ruby Docs And you will have to add origin like this to push to github

    git remote add origin https://#{user_username}:#{user_access_token}@github.com/#{user_username}/#{project_name}.git"