0

Our team have to always submit code on git after their work. And on every PC there are a lot of projects. All system running with Ubuntu OS. So I need some solution for overcome this manually commit on Git.

It is good if we can submit them on a single click only (upload in batch mode folders of a PC).

1

You can do this with a bash script, example:

#!/bin/bash
### project 1 ###
cd /project1path/
git add all
git commit -m "Automatic save commit initiated at $(date)"
git push origin master --repo https://name:password@domain.name/name/repo.git

### project 2 ###
cd /project2path/
git add all
git commit -m "Automatic save commit initiated at $(date)"
git push origin master --repo https://name:password@domain.name/name/repo.git

...

Then you can chmod this bash script with 755 permissions like this:

chmod 755 autosave-script

After that change to UI and open nautilus and create a link on the desktop and youre done.

If the script wont start at a double click in nautilus open the file properties and change it according to the following screenshot:

enter image description here

You will have to do this step on each machine you want to use that script.

  • Thank you for your reply. Should be this file .sh (filename.sh) or anything else ? Where I have put this file and how can I execute this file without terminal ? – vikujangid Apr 28 '16 at 12:08
  • Since Linux/unix does not that wild extention pattern yada yada you can even make it without the .sh which may be misleading later if you ever maybe do this script in phyton, just make sure the shebang is the first line. The .shextension is only added as an indicator for us stupid humans :D – Videonauth Apr 28 '16 at 12:10
  • Ok and I how can I execute this file without terminal? Like double click on file and it execute. Right now if I dbclick on it, it is opening in a text editor. – vikujangid Apr 28 '16 at 12:17
  • Ah ok let me cover that aswell in my answer just give me a minute. – Videonauth Apr 28 '16 at 12:20
  • Thank you, most of done but only problem still there. I have added the username and password in file but still asking me for username and password after run this file. Rest commands are working well but username and password not filling itself. #!/bin/bash ### project 1 ### cd /opt/lampp/htdocs/project git add -A git commit -m "Automatic save commit initiated" git push origin master git username git password – vikujangid Apr 28 '16 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.