M
M
m4tkv2019-11-07 12:39:59
git
m4tkv, 2019-11-07 12:39:59

How to push changes from git to server?

I am new to git.
From my computer, I go to github to a closed repository.
The server already has this project, but it is not installed via git, but via ssh. It has a lot of fiddling with folder permissions and all that.
How to transfer changes from the github repository to the server?
on the server in the project folder:

git init
git remote add origin https://github.com/..........
git pull origin master

I get an error
* branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
error: The following untracked working tree files would be overwritten by merge:
...
Please move or remove them before you can merge.
Aborting

I understand that he says that some files will be overwritten, I don't mind, as it is necessary - to get new files.
In general, tell me how to properly implement this operation.
Additional question. I want git not to change connection files in the database.
Should I add it to .gitirnore /config/db.php on the server?
If you do this, then the /config/db.php file on the server will be ignored by git and the changes will not be applied?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2019-11-09
@mih-kopylov

In general, you are doing everything right.
It looks like the cause of the error

error: The following untracked working tree files would be overwritten by merge:
that the folder where you initialized the repository with the command git initalready contains some files.
Make sure there are no other files or folders in this folder other than .git.
This can be done, for example, by running the command git status.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question