Deployer (deployer.org) not deploying the git repository - laravel

I am using deployer (from deployer.org) to deploy Laravel and Magento 2 sites. From what I understand, it should deploy the .git folder also to a server. But for my configuration it does not do it somehow.
How can I make sure the git repository is also deployed and is available on the server after a deploy?
To make clear what the issue is, steps to reproduce (for me).
Deploy to server with deployer (dep deploy)
Login to server with SSH
Go to project directory
Typ in git status
Expected result:
app#e1a372088c46 ~/application (master)$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean`
Actual result
app#app:~/public_html/application$ git status
fatal: not a git repository (or any parent up to mount point /)

Related

Using GIT Server(Windows), Not able to Clone back in GIT Server

I am running a Git Windows server. I am trying to access files locally on a Windows machine. I successfully cloned the bare repo from remote to local, but when I try to push a locally created committ, the new files do not show up on the remote server. There is no error message.
I created a bare repo on a remote server:
/path/demo.git
I cloned successfully locally with this command:
git clone ssh://username#IP:/path/demo.git
Please tell me how to push commits from the local repository to the remote repository.
When you run git clone you automatically get origin as a remote referencing the path to the repository you cloned.
You can ensure that you push implicitly to the same remote branch through configuration:
git config --global push.default current
Then create some commits and run git push.

fatal: remote <Repository> already exists

As part of the development of a CI & CD flow for the company I work at, I am building a command line program (Bash script on OSX) that
creates a new local Git repo
adds some default branches to this repo
Then adds a new repo to Bitbucket using the next code:
gitUserName = Joris <-- provided by the user, this is an example
projectName = TestProject <-- provided by the user, this is an example
git remote add $projectName "https://bitbucket.org/$gitUserName/$projectName.git"
After running this command, I don't see the repository on my Bitbucket account on the website. When I try to re-run this command, it says the repository already exists.
Also, when I run git push $projectName master it says fatal: repository 'https://bitbucket.org/Joris/TestProject.git/' not found
This behavior seems inconsistent, and I have followed the Atlassian guide to set this up so I don't really understand why it doesn't add the repository as expected. I do realize that I can also just go on the BitBucket website and add the repository manually, but the purpose of my program is that it generates a fully set-up repository for a user based on as little commands as possible.
The git remote add documentation says that the command adds a remote to the local repo. This terminology is, IMO, a bit off; it would better to say it adds a remote configuration to the local repository (i.e. configures the repo to access a remote). This does not actually create the remote repo; that must be done separately.
In the case of bitbucket, the "normal" thing to do is to go to the website and create the repo through their UI. Because you're trying to automate things, you don't want to do that; so in that case, you would need to use the BitBucket REST API, which is documented here: https://developer.atlassian.com/server/bitbucket/reference/rest-api/
The "Core API" section talks about repositories and permissions, so you should be able to script out requests to (if necessary) check if the repo exists and set it up if it doesn't. You'll just need a way for your script to send HTTP requests and receive the responses.
In your machine:
Create repo:
git init
Add branches:
git checkout -b branchX
git checkout -b branchY
git checkout -b branchZ
In Bitbucket website:
Create new repository named TestProject, allow write permissions to user Joris in settings and save. Finally copy the url of the repository, this must be something like bitbucket.mydomain:port/nameofproject/testproject.git (Notice this is all in lowcase)
In your machine:
git remote add origin theURL
git push origin *:*
git push origin --tags
The last is the command to push all your local repo, this will overwrite the history and tags in your remote repo, but since is a new repo it doesn't matter.

How to check if my repository has been deployed to heroku?

I have several repositories and only one has been deployed to heroku. How do I find out which one? Because I made a change in one repo and tried to push it but got a warning fatal: 'heroku' does not appear to be a git repository. Is there a command?
It looks like you have not created heroku repository yet or you are in wrong directory. Go to the directory where you have your app then create heroku with the help of below commands.
git init
heroku create
after creating heroku you can add and commit heroku with the help of
git add .
git commit -am "any comment"
last step will be to push all your data to heroku server by
git heroku push master
If repository is already created, you can check associated repository by hitting below command
$ git remote -v
You may need to run heroku git:remote command to associate a Git repository with an existing application
for more information on how to deploy app click here

How to push in heroku?

I clone my repo down and change something and commit,
but when I want to push like the tutorial:
git push heroku master
it tell me wrong:
fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I'm sure I have log in,
so how can I push my repo correctly and deploy it?
From Git Reference (http://gitref.org/remotes/#remote):
"So that you don't have to use the full URL of a remote repository every time you want to synchronize with it, Git stores an alias or nickname for each remote repository URL you are interested in. You use the git remote command to manage this list of remote repos that you care about."
You can check if remote named "heroku" exists for your git repo using:
git remote -v
If it doesn't exist, you need to add it before you can push updates as follows:
git remote add heroku git#heroku.com:appname.git
where appname should be the name of your app.

How to make a devel enviroment on my app on Heroku

I wonder now about an option to have a devel version of my project on Heroku address. I mean, I have my project on the address my-random-name.heroku.com and here from my local directory I deploy my app.
Is possible from my local directory deploy my app to the other address, where I would check the new updates and if these updates will be ok, so I will deploy these changes to the my-random-name.heroku.com (here is my "bright" version of my app).
Yes - Heroku applications are just git remotes, so by pushing to a different remote you can deploy to a different application.
For instance:
git remote add production git#heroku.com:appname-production.git
git remote add staging git#heroku.com:appname-staging.git
will then allow you to deploy to each env with a simple push.
git push production master
git push staging master
If you're using different branches for development and production (a good idea) you can also deploy fairly simply

Resources