- Details
- Written by: Stanko Milosev
- Category: GIT
- Hits: 5673
To write this article, I was using this web page. As as it is written there, first download msysgit, I downloaded msysGit-fullinstall-1.8.5.2-preview20131230.exe, after unzipping it start msys.bat if it doesn start automatically, and write following lines, one by one:
cd ~
git clone https://github.com/git-ftp/git-ftp git-ftp.git
cd git-ftp.git && chmod +x git-ftp
cp ~/git-ftp.git/git-ftp /bin/git-ftp
Now you can close window, and execute git-cmd.bat.
We have to set up our ftp. First go to folder which you want to synchronize, for example C:\gitTest\First, then set up ftp user and pass. For me it was something like this:
git config git-ftp.user ftpUser
git config git-ftp.url www.milosev.com/gittest
git config git-ftp.password ftpPass
Initialize:
git ftp init
Now we can push:
git ftp push
And enjoy :)
---
if you are receiving error like:
error: could not lock config file .git/config: No such file or directory
Then do something like
mkdir .git
git config --global user.email "
and error message is gone. Taken from here
---
Also, it seems that before git ftp init we have to execute git init command
---
and if you are receiving error like:
fatal: bad default revision 'HEAD'
Then it seems that first you have to commit to your local git repository, something like I already described here.
---
To download to my local machine, first I had to copy my source with simple ftp client, then to repeat all previous steps to have git local repository... I couldn't find another way...
Also, when I already have repositories, after getting the source with ftp client then when I execute:
git ftp catchup
I will keep my history...
---
It seems that something like
git pull ftp://userName:
should also work, except in my case...
---
Finally, this is my procedure how I am doing git for ftp:
git add . --all
git commit -m "Commit locally"
git ftp push
I don't understand why I have to execute "git add . --all" but without that my code will not be added to the git.
- Details
- Written by: Stanko Milosev
- Category: GIT
- Hits: 9537
First download git for Windows. There are lot of git installations, I downloaded this one. After I created two folders, like First and Second, then I opened First folder in command prompt, like I described it here. Then in command prompt I executed command:
git init
After execution of that command I received message like:
Initialized empty Git repository in C:/gitTest/First/.git/
In notepad I wrote one text file, which had only one line "first", and I name it first.txt. Now I wrote:
git add .
Dot on the end means to everything what is in that folder, and after I wrote:
git commit -m "test"
Now we can go to second folder, and open command prompt from there, and write:
git clone c:\gitTest\First
Now you will see in your folder "Second" there will be folder First, with first.txt file. Now lets open file:
C:\gitTest\Second\First\first.txt
and write, for example, second, save and close the file in command prompt go to folder for example:
C:\gitTest\Second\First
and write:
git add "first.txt"
after that:
git commit -m "test2"
Now lets go to first folder, and pull changes, that means in folder C:\gitTest\First in command prompt write:
git pull C:\gitTest\Second\First
Open file C:\gitTest\First\first.txt and see the magic.