I have the following setup concerning Git:
- A small server running Arch Linux and the default Git client. I have this setup to automatically make changes to certain files and then push those changes to my Github repository.
- My Windows 8.1 PC with SmartGit installed. I occasionally make changes to files that I then manually push to my Github repository.
The problem I am having is that when I make some changes to the files on my Windows PC then push those changes, my Arch Linux server apparently loses the ability to push it's changes to the remote repository. The Arch Linux client is able to push it's automated changes without problem up until I push something with the Windows PC. Something breaks after that happens. The only way I've found that fixes this problem is to delete the local repository on my Arch Linux server and then create a new local repository by pulling from the remote.
I scripted the Arch Linux client to pull and fetch from the remote repository before making any changes and I do the same when I make changes on my PC.
Please can someone help me figure out why this is happening and what I can do to stop this problem from occurring in future? Help will be greatly appreciated.
Here are the scripts I am using on my Arch Linux server:
Main script:
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
# Test if an internet connection is present
ping -c 3 google.com > /dev/null 2> /dev/null
if [ $? != 0 ]; then
exit 1
fi
# Git requires that the working directory be the repository I am working with
cd /home/git-user/repositories/xjdhdr-random-code
# Update local repository to ensure no conflicts exist before I make changes
/home/git-user/bin/expect-gitpull.sh
# snip: Everything between these two commands basically make a lot of changes to a lot of text files. Probably has nothing to do with Git or my problem.
# Commit changes to remote repository.
cd /home/git-user/repositories/xjdhdr-random-code
git add -A -f --ignore-errors --
git commit -m "Automatic commit of machine generated changes to repository" --no-edit --
/home/git-user/bin/expect-gitpush.sh
exit 0
/home/git-user/bin/expect-gitpull.sh
#!/bin/expect
set password {*don't need anyone to see my passphrase*}
cd /home/git-user/repositories/xjdhdr-random-code
spawn git pull origin
expect "Enter passphrase for key '/home/git-user/.ssh/id_rsa':"
send -- "$password\r"
send -- "\r"
expect "%PROMPT%"
spawn git fetch -p origin
expect "Enter passphrase for key '/home/git-user/.ssh/id_rsa':"
send -- "$password\r"
send -- "\r"
expect "%PROMPT%"
/home/git-user/bin/expect-gitpush.sh
#!/bin/expect
set password {*ditto*}
cd /home/git-user/repositories/xjdhdr-random-code
spawn git push --recurse-submodules=check
expect "Enter passphrase for key '/home/git-user/.ssh/id_rsa':"
send -- "$password\r"
send -- "\r"
expect "%PROMPT%"