Git pull and git click once

Is it possible to have git pull and git push in the same git command?

The syntax like git pull & git push does not suit me completely, since I need to provide my credentials to the server twice: click and click.

So, I am wondering if there is any workaround for this? I believe this should be, as it is a fairly common case where a developer retrieves a remote origin before pushing local changes.

EDIT : I am using Windows 7 / x64, msysgit-utf8 1.7.9

+6
source share
3 answers

First of all, you can configure the _netrc file that Git will use, here is the problem associated with it: Git - How to use the .netrc file for Windows to save the user and password Then you can configure the alias for the command:

 git config alias.publish '!git pull && git push'` 

And just type: git publish

+4
source

In this case, I recommend doing something simple and dirty. This may not be the most efficient way to do this, but I would just create a bash script in vim using the commands and run them, given how simple the commands are. Then you can simply open this file every time you want to pull and click at the same time.

All you have to do is create a file, put in two lines of commands that you want to write, and enter this file name on the command line whenever you want to execute them.

Again, not the most effective way, but a quick fix.

0
source

You are better off using SSH, but if you cannot use SSH, you can always use the Windows credential store to save your password, so you do not need to fill it in twice:

 git config --global credential.helper wincred 

Source: Git documentation

0
source

Source: https://habr.com/ru/post/918754/


All Articles