git production , development environment - python

I have a project of python files on a network drive called "Development".
I create branches off Development for new features and then merge back into Development once finished. Others in future will also do this.
I want to push "Development" into another separate folder called "Production" and for the life of me cannot figure out how to do this.
Please any suggests? How to do this?
Thanks.
I get this error when attempting.
Pushing to G:\03 GIS RESOURCES\05 GIS PROGRAMMING\Production
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To G:\03 GIS RESOURCES\05 GIS PROGRAMMING\Production
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'G:\03 GIS RESOURCES\05 GIS PROGRAMMING\Production'

Option A
You can clone your Development project into another folder.
Synopsis:
git clone <repository> <directory>
Example:
git clone <path/to/Development> Production
Option B
Copy the content of folder Development (including .git folder) to folder Production.

Related

Build on Heroku , Git issue with Push Failed, error in message :)

me again...can I please have some help, going a little bonkers here..
I have a simple Python script that I would like to connect to a scheduler task in Heroku...Its all going fine until I try deploy to Heroku. Its super simple script and its doing my mind in trying to work out why I cant deploy it.
Followed the instructions exactly from here..
https://dashboard.heroku.com/apps/*********/deploy/heroku-git
Getting this error:
(base) simon#Simons-Air ********** % git push heroku master
Enumerating objects: 47, done.
Counting objects: 100% (47/47), done.
Delta compression using up to 8 threads
Compressing objects: 100% (47/47), done.
Writing objects: 100% (47/47), 4.11 MiB | 581.00 KiB/s, done.
Total 47 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: ! No default language could be detected for this app.
remote: HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote: See https://devcenter.heroku.com/articles/buildpacks
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to **********.
remote:
To https://git.heroku.com/**********.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/**********.git'
Ive been into Heroku web interface and selected buildpack of Python (hoping that might be it), but still no luck.
Im on a Mac, using Visual Studio Code, with embedded terminal.
Any thoughts people?
Would be so grateful for any help.
Thanks again
Simon

problem pushing changes to GitHub because of file that's not really there

I have been trying to push changes to my GitHub repo but been facing this problem:
Uploading LFS objects: 100% (164/164), 153 MB | 0 B/s, done.
Enumerating objects: 25977, done.
Counting objects: 100% (25968/25968), done.
Delta compression using up to 4 threads
Compressing objects: 100% (18133/18133), done.
Writing objects: 100% (25955/25955), 146.83 MiB | 232.00 KiB/s, done.
Total 25955 (delta 6561), reused 25816 (delta 6463)
remote: Resolving deltas: 100% (6561/6561), completed with 4 local objects.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 9f797e9b5f7a1c01fca6706ad62e21ba
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File venv/lib/python3.6/site-packages/tensorflow_core/python/_pywrap_tensorflow_internal.so is 225.31 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/yovelcohen/nba-stats.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/yovelcohen/nba-stats.git'
(base) yovel#the-beastpad:~$ cd venv/lib/python3.6/site-packages/tensorflow_core/python/
bash: cd: venv/lib/python3.6/site-packages/tensorflow_core/python/_pywrap_tensorflow_internal.so: No such file or directory
I imported TensorFlow to the project but then removed it, when trying to delete it from the terminal it's not there (and when looking for it manually).
any help would be appreactied!
Since you should not push any generated binary file anyway, start first by removing them locally, commit and push:
git rm -r '*.so' -f
echo '*.so' >> .gitignore
But if that still fails, it means you are trying to push past commits (not just the latest one) with *.so files, even though the last commit no longer includes any such files.
If that is the case, since git filter-branch is soon deprecated, consider newren/git-filter-repo to remove any large files like those *.so ones, before pushing (or force pushing of that rewrites the content of past commits previously pushed).

How to clear cache on building Gitlab?

Gitlab can't clean my cache on building.
How to fix this problem?
Executor: shell
Fetching changes...
warning: failed to remove config/__pycache__/__init__.cpython-36.pyc
warning: failed to remove config/settings/__pycache__/local.cpython-36.pyc
warning: failed to remove config/settings/__pycache__/__init__.cpython-36.pyc
warning: failed to remove config/settings/__pycache__/common.cpython-36.pyc
warning: failed to remove config/settings/__pycache__/test.cpython-36.pyc
warning: failed to remove docs/__pycache__/__init__.cpython-36.pyc
Luckily I was having the exact same issue as you (I think).
A little background:
I was using gitlab ci to build using a remote runner (shell) that
would build a docker image and then run some tests.
Cause:
I was mounting a local directory inside the container by passing the -v flag to docker run (there are other ways to do this with compose yml for example).
Because the docker container runs as root the generated __pycache__ directories and files are owned by root on the local filesystem; This means that docker-runner does not have permission to delete them on the next build.
The solution:
Remove the mount and copy the files instead.
I workaround by not let python create *.pyc files
https://docs.python.org/3/using/cmdline.html#envvar-PYTHONDONTWRITEBYTECODE

Fabric show print after executing commands

I have a post-receive hook on my git bare repo that excute this fabfile.py:
def deploy():
print(cyan('Pulling changes to local server'))
with cd('/var/www')
local('git pull')
It executes fine, but it shows the output for the local command before the print, like this:
remote: From /media/projetos/repositorios/test
remote: b057a4b..02d85b3 master -> origin/master
remote: Updating b057a4b..02d85b3
remote: Fast-forward
remote: .../test/template/catalog/product/list.phtml | 98 +++++++++++-----------
remote: 1 file changed, 47 insertions(+), 51 deletions(-)
remote: Pulling changes to local server
If i just ssh on the server and run fab deploy it works normal.
Add a sys.stdout.flush() call after printing, so that even if output is fully buffered (as it is on a pipe, which is the case when running under a git hook), it is sent to the output stream at that point, before running another command.

Deploy pure python to heroku

I "finished" a little python project and I want to deploy it on heroku
GitHub page.
I want to execute: python2 main.py -i json-rpc
in order to have the json-rpc server listening for connections
but I get the following error when pushing to heroku:
$ git push heroku master Counting objects: 153, done. Delta
compression using up to 8 threads. Compressing objects: 100% (87/87),
done. Writing objects: 100% (153/153), 43.42 KiB, done. Total 153
(delta 61), reused 153 (delta 61)
-----> Heroku receiving push ! Heroku push rejected, no Cedar-supported app detected
To git#heroku.com:panager.git ! [remote rejected] master -> master
(pre-receive hook declined) error: failed to push some refs to
'git#heroku.com:panager.git'
What you might want to try doing is creating a Procfile. The full filename is Procfile, no extension, and it goes in the main directory of your project folder.
The content of that file would be:
web: python main.py -i json-rpc
Give that a shot and see if it works.
Alternatively, you may have forgotten to create a virtualenv for your app.
You should follow the instructions in Heroku's guide Getting Started with Python on Heroku
Update:
Having finally tested this myself on a fresh Heroku app, what you're missing is a requirements.txt. Even though you don't have any dependencies, you still need it. Within your virtualenv in the main project folder, run pip freeze > requirements.txt, and then git add . then git commit -m "added requirements.txt", and then push to Heroku and it should work.
Also, make sure that requirements.txt is saved with ANSI encoding, not Unicode or UTF-8! If you're a total n00b like me you can simply open requirements.txt in Notepad, choose SAVE AS and change the "Encoding" from the drop down. I tried all of the recommendations above but my error was due to this simple encoding problem.

Categories

Resources