Update a GitHub project wiki through the GitHub API - github-api

Is there a way a developer can automatically upload Doxygen documentation for his project hosted on GitHub through their API?
I didn't find anything on develop.github.com related to this. It would be nice if one could just SCP the files or something.

It's now possible to check out the wiki as a separate Git repository. You could clone the repository, add the pages to it, and push it. You can clone the repository from this URL:
git#github.com:user/project.wiki.git

There is no way, at this time, to access the GitHub wiki via the API. However, there is a much better solution already built into GitHub. Since Doxygen outputs static HTML pages, you can push them to the gh-pages branch of your project and access them at username.github.com/projectname
For more information, http://pages.github.com/.

Related

Can I use README files in github pages

I am working on a website to host on github, and I want to add README.md file, to let people know what exactly is it.
So is it ok to do that, would that end up in error
Yes, you can add a readme.md file to any Github repo. Github offers extensive documentation on how this works.
If I read into your question more deeply, I think what you're really asking is that if you add a readme to a project being hosted on Github pages - will that effect how the hosted website is presented? The answer would be no. In this case, read about how Github pages hosting works.

How do I use Octokit to turn on Github Pages for a repo?

I have a Ruby program that makes a new repo for a user using Octokit. I would also like to enable Github Pages for the repo from my program, but I can't figure out if that is possible. The Pages API seems to assume pages are already enabled.
There is no specific API to call when "enabling" the GitHub page feature.
As described in "Configuring a publishing source for GitHub Pages"
If your site is a User or Organization Page that has a repository named <username>.github.io or <orgname>.github.io, you cannot publish your site's source files from different locations.
User and Organization Pages that have this type of repository name are only published from the master branch.
For other project repos, the following settings needs to be set manually first:

Push files to GitHub from NodeJS server

I have a NodeJS server which is generating a server-side JS code into a separate folder on the server and then serves it to the user as a .zip file. I would like to be able to take this code and push it to a GitHub repository the user would specify (or even better- create a new brunch and push it to the branch). I was checking GitHub API but I could not find an endpoint, which would describe this situation. I also checked one node module, but the same story- no information about if this is possible (and how) or not.
My question is- Is it possible to take a folder on a server and push it to a GitHub repo (if all the credentials and keys are known) programatically and if so, can anyone please direct me to some resources? I tried to find something but nothing was relevant.
Thank you,
T.
I've just found these two libraries, that can help you to push your files to git from Node.js:
git-js is a lightweight wrapper around installed git binary
nodegit is a standalone Git client implementation in Node.js
Just use the provided API programmatically to commit and push files. You could create a separate branch if you want and tag your commits.
just install git bash and do it through that. I don't use anything but the terminal to do my git repos. good luck.

import entire GitLab Cloud project to new GitLab instance

I have some projects set up on GitLab Cloud, complete with issues, wiki pages, etc. I've recently set up an internally hosted gitlab instance. I'd like to bring these projects over from GitLab Cloud to the internal GitLab instance.
Bringing over the git repos seems easy enough (change the remote and push), but I don't see how to bring over the wikis and issues.
In general it seems like this isn't possible. (There's a GitLab Feedback for it here.)
However, the project wiki's seem to be their own git repos, which you can see on the Git Access tab. While that doesn't solve issues/snippets, it gets you part of the way there.
I don't know how to transfer over issues as I have not had to do that yet, but passing over the wiki is not that difficult.
On your old gitlab instance you will notice two repositories for your project (let's pretend your wiki is oldproject), one will say something like oldproject.git and oldproject.wiki.git.
The general path to the repositories where you can see the names I am talking about (let's assume user-name is "myaccount") can be found here:
/home/git/repositories/myaccount/
or (if using the omnibus installer):
/var/opt/gitlab/git-data/repositories/myaccount/
I presume you already know how to transfer over oldproject.git. You do the exact same thing with the wiki, only you create a bundle file out of oldproject.wiki.git:
git clone http://gitlab-instance-ip/user-name/oldproject.wiki.git
cd oldproject.wiki
git bundle create oldproject-wiki.bundle --all
Now initialize your new project in gitlab...I presume you already know how to do that as you suggested in your question that you know how to import the files from your project over to the new instance without problem. Now repeat for the wiki:
git clone http://new-gitlab-ip/user-name/newproject.wiki.git
cd newproject.wiki
git pull /path/to/oldproject-wiki.bundle
git push -u origin master
I had a very similar problem to yours where I didn't see that anything was actually "pushed". When I went back to the gitlab project I noticed that it was in fact updated with the wiki. See here if you think it will help: Importing Gitlab Wiki to a new Gitlab Instance
Good luck!

How to deploy a node app to azure if the node app is buried in repo directory

I am trying to deploy a project to azure, via the "remote git repo" method. But in my repo, the actual node application is a few directories in. Thus, Azure does not do anything when the repo is pushed.
Is there some way to configure the azure website to run from a directory buried in the repo?
There's a super easy way actually. This scenario was anticipated by the Azure team and there's a good way to handle it. It's simple too.
You simply create a text file at the root of your project called .deployment. In the .deployment file you add the following text...
[config]
project = mysubfolder
When you either Git deploy or use CI to deploy from source control, the entire repository is deployed, but the .deployment file tells Kudu (that's the engine that handles your website management) where the actual website (or node project) is.
You can find more info here.
Also, check out this post where I mention an alternative strategy for project repos in case that helps.
This isn't so much an Azure question as a Git question. What you want to know is if there is a way to clone only a sub-directory or branch of a project. From doing some research on this just a couple of weeks ago, the best I could find were solutions for how to do a sparse clone, which does allow one to restrict the files cloned (almost there) but does so within the entire project's directory structure (denied).
A couple of related SO questions & answers which you might find helpful:
How do I clone a subdirectory only of a Git repository?
(Short answer 'no')
Checkout subdirectories in Git?
(Answer describes the sparse checkout ability).
I would love to see if a git guru might have a better answer based on updates to git, etc.
Good luck with it - I ended up just putting my node app in its own Git project as it seemed the most straightforward approach overall, though not ideal.

Resources