Using github CLI (cli/cli) to deploy repo - github

Trying to deploy internal development from GitHub to a Centos 7 webserver, running into 2 issues.
Firstly, I'm using PHP and need to deploy the class files to a folder that is not /var/www/html/, where I have cloned the repository to using
cd /var/www/
gh repo clone linkto/repo html (this may be the wrong thing to do).
Secondly, Prompting me to think that I've done the first part wrong, when trying to use gh repo sync linkto/repo i get the error can't determine source repository for GitUser/home because repository is not fork leading me to believe that instead of cloning I need to fork it. My intention here is that no code would ever be changed on the server-side just updated on GitHub then push to the server. Am I trying to do too much with GitHub? or am I trying to do it wrong?
EDIT:
doing cd /var/www/html/ gh repo fork gh repo sync and setting a remote back to the origin has solved the second issue
Thanks,

In
cd /var/www/html/
Running once to setup:
gh repo fork with a remote set to the origin
Each time to update:
gh repo sync setting the base repository each time to update
Then using
https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
a server-side post-receive hook to move the classes directory to the desired location

Related

Upload to Heroku from GitHub other ways

As the GitHub linking is no longer working due to security issues, my app is still on GitHub and I want to put it on Heroku how do I do this easily?
As the security notification says, you can still deploy via git push.
Assuming you have a local copy of your repository¹ and you would normally do something like git push origin main to deploy to GitHub:
cd to your project directory
Check your remotes:
git remote -v
Do you see a Heroku remote?
If so, make note of its name and go to the next step.
Otherwise, add one:
heroku git:remote -a YOUR_APP_NAME
Now, push directly to the Heroku remote. Assuming it is called heroku:
git push heroku main
You'll probably also want to push to GitHub to ensure the code for your latest release is synced.
I believe this is the simplest option if you're migrating from GitHub integration, but the documentation also lists other options:
Docker-based deployments
Using dpl
Via Git hook
Via Terraform
¹If, for whatever reason, you don't have a local copy of your repository, git clone it from GitHub and then proceed as above.

From github CLI, how to change from local repo to a repo on a differnt server, to create issue on that repo?

I am new to GitHub Command Line Interface (CLI).
From the github command line interface, I'd wanted to create an issue, but mistakingly selected a local repo intead of the repo from which I forked from. So how can I change from the local repo to the repo from a different server, where I forked and cloned from, please?
gh issue create --web is an interesting alternative, because by opening the GitHub issue web page, you would immediately realize you are not on the right repository.
As commented, you would need to use the -R option to reference the upstream repository (as opposed to the default one)
Make sure to use the latest gh version though, at least 1.60 or more, since gh issue create -R used to ignore issue template before. (issue 2361)

Not pulling to right repository?

It's not pulling the right repository to move files I believe.
I am pretty sure I'm in the right directory.
It's 2:35 in the video I'm trying to follow along with - https://www.youtube.com/watch?v=0_-mP0RjsVI&t=164s
You are trying to push, not pull.
You would need to create the target remote repository first (https://github.com/Deanyboybopper/Tester.git)
If you have not created it, install the GitHub CLI gh, and create it from your workstation with gh repo create
cd /path/to/local/Tester
gh repo create --source

Cloned and Pushed a Forked Repo Successfully, Which Does NOT Read on Github

Using git bash, Windows 10 64x.
Successfully forked a repo, and cloned it to mine.
Was able to read it on my computer.
Also, there was no technical issue in pushing the repo (to my repo, not as an upstream) - can't click on 'datasharing'.
But I cannot read it on GitHub, and can't figure out why.
Please help me.
datasharing seems to be a submodule there. This means the original ower of the repo is using code from a foreign repo in his project. In order for you to use this code in a cloned repo you will have to obtain it separately after cloning your main repo. Imagine this like cloning a repo into a repo. This method is often used and perfect for referencing to external code while keeping all the advantages of version management rather than copying a static version of a library into your project.
Obtain the external code as follows:
Clone your repo as usual and cd into the folder.
git submodule init
git submodule update
The external code will be integrated into your repo and pushed/pulled with it. Not being able to click that folder seems to me as if github is aware of its existence but lacks the content.
For an exact reference on this topic you may want to read up on submodules in the docu found here.

Github pulling, without using a github account?

I have a small embedded linux system image which I deploy for users. It has a Python project on it that checks github using git ls-remote --heads for changes and does a git pull to pull the latest version.
There is no need for writing anything to the repository, it's actually better if that's not possible, since these systems are outside of my control. Because of that I also don't like to put my own Github credentials on it.
Is it possible to use Github in this sort of semi-public manner?
If so, what would be a good minimalistic (i'm guessing SSH) setup?
(by the way, this used to work, but recently stopped working, I've not figured out why yet. I have never before set up any key's or whatever, so i'm guessing this should be possible..)
You can just clone the repo:
git clone git://github.com/SomeUser/SomeRepo.git
The local repo will be "read-only" in the sense that you won't be able to push your changes back to the remote repo. You will still able to modify files and commit changes locally.
Use HTTPS (https://help.github.com/articles/which-remote-url-should-i-use/)
Configure git as follows to suppress the self-signed cert warning: git config --global http.sslVerify false