Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to config git to pull from http and push through ssh in one 'remote'?

Pulling from http to escape authentication(so I don't need to type password if I'm not using ssh.keygen).

Pushing through ssh with authentication.

like image 402
Tsung.W Avatar asked Aug 24 '10 02:08

Tsung.W


People also ask

How do I push a git repository to a remote server?

In order to push a Git branch to remote, you need to execute the “git push” command and specify the remote as well as the branch name to be pushed. If you are not already on the branch that you want to push, you can execute the “git checkout” command to switch to your branch.

Does git pull connect to remote?

The git pull command automatically fetches and then merges the remote data into your current branch. Pulling is an easier and comfortable workflow than fetching. Because the git clone command sets up your local master branch to track the remote master branch on the server you cloned.


1 Answers

From the git-config man page:

remote.<name>.url The URL of a remote repository. See git-fetch(1) or git-push(1).

remote.<name>.pushurl The push URL of a remote repository. See git-push(1).

Try setting the former to an http: url and the latter to a git+ssh: (or just git:) url?

like image 90
Amber Avatar answered Sep 26 '22 06:09

Amber