git-push | Use git-push to deploy your website to Azure Heroku | Continuous Deployment library
kandi X-RAY | git-push Summary
kandi X-RAY | git-push Summary
Use git-push to deploy your website to Azure, Heroku, GitHub Pages or any another hosting provider supporting Git-based deployments.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of git-push
git-push Key Features
git-push Examples and Code Snippets
Community Discussions
Trending Discussions on git-push
QUESTION
In my desktop, I have a folder named azerty, into this folder I have a file named index.html
.
Into this file, I wrote
test
.
On Bitbucket, I have to create my repository. I named this repository like the name of the folder which is on my desktop, so azerty
.
My repository is created
Now, I open GIT bash.
Here are my steps:
...ANSWER
Answered 2021-Jun-03 at 09:22When you cloned your repository, Git cloned it into a new folder azerty
inside the directory that you already initialised as another Git repository. You should use either git clone
or git init
(and add a remote later) but not both.
So now you have an initialised repository without a remote which is why you get the error that origin
is not know. And you have a cloned repository (with a remote) inside the azerty
folder.
I recommend that you just delete both local repositories and start from scratch. You can specify the directory that a repository should get cloned into by passing this as an argument to git clone. To use the current directory, simply pass a .
.
QUESTION
I'm setting up a deploy-on-git-push process on a remote Debian server. It is basically the common approach of having a bare repository with a post-receive hook which does a checkout to the web server's docroot, more or less.
I've used slightly simpler variations of this set up successfully for years, but this time around I'm complicating it by trying to separate ownership of the git repo and the site files between 2 different users. I don't want the user who can SSH in (the git push happens over SSH) to have write perms to the site, and vice-versa (the site user shouldn't have write perms to the git repository).
I have 1 user, let's call her
git-user
, who owns a bare git repository at/var/gitrepos/my_site.git
, and this user is the only user allowed to connect over SSH;I have a 2nd user, say
site-user
, who should own the checked-out files at/var/www/site
;
I push over SSH to the repo, and this means any post-receive hook runs as the user I SSH in as - git-user
in this case. So the post-receive hook can't do the checkout itself, as the site files would end up being owned by git-user
, not site-user
.
So my post-receive simply touches a trigger file, /var/run/deploy
. A separate script is run from site-user
's cron frequently, eg every minute, looking for that file. If it sees it, it does a checkout to /var/www/site
. The relevant part of that script looks something like:
ANSWER
Answered 2021-May-16 at 14:07Another option would be for the git-user
to create an archive that contains all the relevant files to be deployed (think of it as an artefact). This can be done in the post-receive hook before touching the trigger file. To create the ZIP/TAR, you can use the git archive
command which facilitates this step.
As soon as the cron-job runs and a deploy is triggered, the site-user
extracts the contents of the archive into /var/www/site
and removes the archive.
This way, the git-user
has no access to the webroot. At the same time, the site-user
does not even need read-access to the repository.
It is also possible to specify an alternative index-file with the environment variable GIT_INDEX_FILE
to circumvent the default location ($GIT_DIR/index
). But I don't know if Git needs write access to other files/folders as well.
QUESTION
I am currently experiencing a problem that is really puzzling me. I want to tag a git commit via an Azure Devops build pipeline. I followed this tutorial: https://elanderson.net/2020/04/azure-devops-pipelines-manual-tagging/ and the only thing that I am diverging in is the use of bash instead of PowerShell. (I tried with PowerShell too, but I got the same error)
The error I am getting is this:
My build definition is here
...ANSWER
Answered 2021-Apr-29 at 01:13If you don't have any specific rule on which branches/commits to tag, you can set the pipeline to add Tag automatically upon completing the build
QUESTION
When I want to force push, I nearly always use --force-with-lease
. Today I upgraded to Git 2.30 and discovered a new option: --force-if-includes
.
After reading the updated documentation, it's still not entirely clear to me under which circumstances I would use --force-if-includes
instead of --force-with-lease
like I usually do.
ANSWER
Answered 2021-Jan-22 at 04:02The --force-if-includes
option is, as you've noted, new. If you've never needed it before, you don't need it now. So the shortest answer to "when should I use this" would be "never". 🙃 The recommended answer is (or will be once it's proven?) always. (I'm not yet convinced one way or the other, myself.)
A blanket "always" or "never" is not very useful though. Let's look at where you might want to use it. It is, strictly speaking, never necessary because all it does is modify --force-with-lease
slightly. So we already have --force-with-lease
in effect, if --force-if-includes
is going to be used.1 Before we look at --force-with-includes
we should cover how --force-with-lease
actually works. What problem are we trying to solve? What are our "use cases" or "user stories" or whatever the latest buzzwords might be when someone is reading this later?
(Note: if you're already familiar with all of this, you can search for the next force-if-includes string to skip the next few sections, or just jump to the bottom and then scroll up to the section header.)
The fundamental problem we have here is one of atomicity. Git is, in the end, mostly—or at least significantly—a database, and any good database has four properties for which we have the mnemonic ACID: Atomicity, Consistency, Isolation, and Durability. Git doesn't exactly achieve any or all of these on its own: for instance, for the Durability property, it relies (at least partly) on the OS to provide it. But three of these—the C, I, and D ones—are local within a Git repository in the first place: if your computer crashes, your copy of the database may or may not be intact, recoverable, or whatever, depending on the state of your own hardware and OS.
Git is not, however, just a local database. It's a distributed one, distributed via replication, and its unit of atomicity—the commit—is spread out across multiple replications of the database. When we make a new commit locally, we can send it to some other copy or copies of the database, using git push
. Those copies will try to provide their own ACID behavior, locally on those computers. But we'd like to preserve atomicity during the push itself.
We can get this in several ways. One way is to start with the idea that every commit has a globally (or universally) unique identifier: a GUID or UUID.2 (I'll use the UUID form here.) I can safely give you a new commit I've made as long as we both agree that it gets the UUID I gave it, that you didn't have.
But, while Git does use these UUIDs to find the commits, Git also needs to have a name for the commit—well, for the last commit in some chain. This guarantees that whoever is using the repository has a way to find the commit: the name finds the last one in some chain, from which we find all the earlier ones in the same chain.
If we both use the same name, we have a problem. Let's say we're using the name main
to find commit b789abc
, and they're using it to find the commit a123456
.
The solution we use with git fetch
here is simple: we assign a name to their Git repository, e.g., origin
. Then, when we get some new commit(s) from them, we take their name—the one that finds the last of these commits in some chain, that is—and rename it. If they used the name main
to find that tip commit, we rename that to origin/main
. We create or update our own origin/main
to remember their commits, and it does not mess with our own main
.
But, when we're going the other way—pushing our commits to them—Git doesn't apply this idea. Instead, we ask them to update their main
directly. We hand over commit b789abc
for instance, and then ask them to set their main
to b789abc
. What they do, to make sure that they don't lose their a123456
commit, is make sure that a123456
is part of the history of our commit b789abc
:
QUESTION
I'm able to push to my Gihub repository just fine with SSH but I'm getting an error when I try to push with the maven release plugin at prepare stage:
...ANSWER
Answered 2021-Apr-05 at 12:07As long as you see nbauma109@github.com
, you can be sure an SSH push will fail (from command-line or maven)
A GitHub SSH URL would always use the remote user 'git
': git@github.com:...
, never the actual GitHub user account name: your public key registered to said GitHub account is suppose to authenticate you.
So start testing with:
QUESTION
I'll try to explain what I did.
My last commit and push to github was at least a couple weeks ago.
I've still been committing regularly.
Recently, I tried to merge changes, but I wasn't able to because I had changed the readme manually on github and needed to pull it down first.
I tried to pull, but that opened VIM.
I tried to enter a commit message like it was asking but I'm not familiar with VIM and I'm not sure if I was successful or not.
I followed some instructions, but I can't remember exactly what happened. I don't think it was successful because the next thing I decided to do was just force a push.
I had everything I wanted locally, expect for the readme, so I figured it wouldn't be that big a deal.
But after doing that, I decided I should try to go back and save the readme first, duh!
I looked up how to go back to the previous commit and followed the first answer here:
How to recover from a git push -force?
basically this
...ANSWER
Answered 2021-Mar-10 at 19:16From your reflog, it looks like you just want to do:
QUESTION
I'm new to GitHub and, after having followed this tutorial, I'm trying to understand SSH keys.
I already created a key and added it to my account. For the moment I have no more than a few test repositories, which I clones locally.
Now, the problem is that, even if I do not set my ssh-agent
(or I remove all the keys from GitHub) I can still update my repos and push to them.
The only thing I can't do with a verified key is cloning a repository using the SSH link (e.g. git@github.com:username/repository.git
), but I can still clone and push to repositories using the https link (e.g. https://github.com/username/repository.git
).
I initially thought that cloning was allowed using the https but I could not push, but I can even push and it does not ask any usernames of passwords!
So, what's the purpose of SSH keys if anyone can still do the same things that I do with a verified key? Does it have to do with privileges and permissions?
...ANSWER
Answered 2021-Mar-09 at 08:57but I can still clone and push to repositories using the https link (e.g. https://github.com/username/repository.git).
When using HTTPS, you would not use any SSH key, only cached credentials (GitHub account username/password), that would be provided by the git credential helper (git config credential.helper
)
QUESTION
Trying to commit my code to GitHub, never had an issues before and I've gone through all quick fixes but no luck so far. The error:
...ANSWER
Answered 2021-Jan-25 at 19:29The issue seemed to be caused by slow internet speeds. Perhaps what I reported was a timeout error.
It wasn't clear to me what specifically fixed it, but moving to another location with faster internet resolved this issue.
I still welcome any other suggestions!
QUESTION
Given a local branch name
...ANSWER
Answered 2021-Feb-10 at 23:50No. This is ... unfortunate, because manually obtaining the first one is easy:
QUESTION
The short version of my question:
Is there a way to conditionally delete a remote branch using git push origin :gh-pages
where the command is skipped or ignored if the gh-pages branch doesn't exist?
The long version of my question:
I'm building a boilerplate / starter template for using NPM as a Build System or Workflow for building basic webpages (instead of using something like Grunt or Gulp). The project uses a /build
folder and I wanted to use Github Pages to serve the contents of /build
. There doesn't seem to be an easy way to do that from /settings (I only see /root, not /build), so I ran across this command:
git subtree push --prefix build origin gh-pages
Which creates a gh-pages
branch and pushes my changes from the /build
folder of my master branch to the newly created gh-pages
branch. Excellent!
Unfortunately, I can't simply update my gh-pages
branch with changes (nor would I want to). I also can't make changes in master
and then merge them into gh-pages
. I get lots of error messages with branches being unrelated, or out of sync, or whatever.
Instead I need to make the changes in master
and then use the git subtree push --prefix build origin gh-pages
command again to push those changes. But I run into another error where it doesn't want to push new changes into an existing gh-pages
branch.
Okay ... So to fix this I added git push origin :gh-pages
to my command. So now my "deploy" command in my package.json looks like this:
ANSWER
Answered 2021-Jan-29 at 06:24You could simply invoke the push-to-delete and continue anyway if it fails. This is crude—it would be better to continue if and only if it fails due to the branch not existing—but serviceable. To continue even if the command fails, use git push origin :gh-pages; git subtree push --prefix build origin gh-pages
.
I would not recommend this method though (with or without something more clever to detect a "desirable failure"). There's another solution in that same comment thread you linked in your own comment that mentions this method:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install git-push
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page