I want to push git easily

Viewed 401

I want to push github without typing username and pass every time.

Using Ubuntu terminal, git asks me every time my user name and pass, when I pushing in MacOS, it did not happen. I am setting correct global setting below.

git config --global user.name "username"  
git config --global user.email "my@email.com"

Saw this, (Why Git is not allowing me to commit even after configuration?) and tried

git config --unset --local user.name
git config --unset --local user.email

but nothing happened.... Please help me.

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = https://github.com/username/sh
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
2 Answers

You have setup your git repository using the https protocol:

[remote "origin"]
    url = https://github.com/kaede0902/sh

The https protocol requires you to enter your username and password every time. You need to use the ssh protocol. For that, you need to create SSH keys first. I would recommend this guide: https://www.testingexcellence.com/install-git-mac-generate-ssh-keys/ . For your use case, when running ssh-keygen -t rsa, do not enter a passphrase.

Then, once that's done, either go to your local repository and execute the following command:

git remote set-url origin git@github.com:kaede0902/sh.git

Or re-clone your repository somewhere else using the following command:

git clone git@github.com:kaede0902/sh.git
Related