P
P
pzverr2014-09-02 11:47:30
git
pzverr, 2014-09-02 11:47:30

How to get changes on a remote server?

Good afternoon!
With git zank not so long ago, the problem is that the scheme for working with a remote repository is not clear (do I need to make it empty -- bare ?).
Actually, I will give an example as I now understand the scheme of work, on the local.
create 2 folders:
The server folder will serve as the remote repository.
local, respectively local.

mkdir server
mkdir local

We create an empty repository.
mkdir hello.git
cd hello.git/
git --bare init
Initialized empty Git repository in /your/folder/server/hello.git/

Working repository.
cd ../local
touch somefile.txt
git init
Initialized empty Git repository in /your/folder/local/.git/

Adding a remote repository
git remote add origin /your/folder/server/hello.git/

Check
git remote -v
everything is ok
origin	/your/folder/server/hello.git/ (fetch)
origin	/your/folder/server/hello.git/ (push)

Add file, commit changes
git add -A
git commit -m "init commit"
[master (root-commit) acf9e28] init commit
 1 file changed, 9 insertions(+)
 create mode 100644 somefile.txt

We push
git push origin master
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 260 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To /your/folder/server/hello.git/
 * [new branch]      master -> master

I look in the server folder, somefile.txt is not there, I can’t understand where I made a mistake, I don’t give any errors when pushing.
Thank you in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Cenness, 2014-09-02
@pzverr

You have created a bare repository . The file somefile.txt is there, just in binary form.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question