How to set deployment?
Asked by kiusau:

Hi, Support Community!

I have cloned my Atlassian repository to my remote server and created a .cpanel.yml file for the purpose of deployment. When I try, however, to push my .cpanel.yml file to my Atlassian repository I am denied.

What are some possibilities for this inability?

Roddy

ps: The problematic result:

$ git remote set-url origin <https://bitbucket.org/kiusau/deflation-made-simple.git>  
$ git push .cpanel.yml  
fatal: invalid gitfile format: .cpanel.yml  
fatal: Could not read from remote repository.

Please make sure you have the correct access rights  
and the repository exists.  
$


Answers:
author: kiusau
body: I have yet to succeed in deployment, but I have managed to succeed with a PULL request from my Bitbucket repository to my HostPapa repository.

This was achieved by the creation of a Bitbucket APP password that allowed me to overcome the Two-Factor Authentication that I use with HostPapa.

I discovered the need for the password when I tried to set up tracking between my Bitbucket and HostPapa repositories. I used the follwoing command:

git branch --set-upstream-to=origin/master master

The APP password was then used in lieu of my account password when the following PULL command was entered.

$ git pull --all  
Fetching origin  
Username for '<https://bitbucket.org>': \<username\>  
Password for 'https://\<username\>@bitbucket.org':  
remote: Enumerating objects: 24, done.  
.  

It probably was irrelevant, but I manually copied my .cpanel.yml file from my HostPapa repository to my local repository and then pushed it up my Bitbucket master branch.

I will now try deployment once more.

Thank you, everyone.

Roddy


author: Patrik S
body: Hello [@kiusau](/t5/user/viewprofilepage/user-id/4744447) ,

Thank you for reaching out to Atlassian Support.

From the commands that you have shared, I think the issue here is because you were not following the correct workflow to push the changes to a git repository.

As per how git works, in order to push your changes to Bitbucket after changing/adding files in your local clone, you have to follow these steps :

* In your local clone of the repository, make the desired changes on the files
* Include the modified/added files in the staging area, so they are included in the next commit :
  * To include all the modified/added files use :  

    ```
    git add .  
    ```

  * To include only a specific file, you can provide the path to the file as the below example (considering the file is in the root directory of your repository) :

    ```
    git add .cpanel.yml
    ```

<!-- -->

* Commit the changes including a commit message :  

  ```
  git commit -m "This is a test commit"
  ```

<!-- -->

* Push the changes to your remote repository :  

  ```
  git push origin
  ```

You can also use the ***git status*** command in your terminal in order to check which changes have been staged, which haven't, and which files aren't being tracked by Git.

Would you please test using the steps above and check how it goes ?

Thanks, [@kiusau](/t5/user/viewprofilepage/user-id/4744447) .

Kind regards,

Patrik S

comments: author: kiusau
body: Hi, Patrick!

I wish it were as simple as you have stated. What you have suggested is once of the first things that I did after cloning. Here is the code:

$ git add .cpanel.yml

$ git commit .cpanel.yml -m "Set up deployment."  
\[master 5edcff4\] Set up deployment.  
1 file changed, 5 insertions(+)  
create mode 100644 .cpanel.yml  

Roddy


author: Nic Brough -Adaptavist-
body: If I'm right about this, then it is not an Atlassian problem, but a git one. Can you check if you have an empty .git file in your home directory or in the current directory?

If you do, remove them and try again.

comments: author: kiusau
body: Hi, Nic!

Thank you for responding.

In answer to your question the .git folder is quite full.

What I did find based on your suggestion, however, is an as-of-yet unexplained .htaccess file with the following sole line, \<Deny from all\>.

In an effort to explain its presence I should note that there is a .htaccess file in the production folder that contains the actual website with the following contents:

order deny,allow  
.

.

.

allow from 104.192.141.1  
deny from all

As you can see the Bitbucket ISP address has been included.

Roddy


Tags: bitbucket-cloud

cloud