Is there a way to cache GitHub credentials for pushing commits?

后端 未结 24 3265
囚心锁ツ
囚心锁ツ 2020-11-21 05:02

I recently switched to synchronizing my repositories to https:// on GitHub (due to firewall issues), and it asks for a password every time.

Is there a way to cache t

24条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-21 05:24

    If you don't want to store your password in plaintext like Mark said, you can use a different GitHub URL for fetching than you do for pushing. In your configuration file, under [remote "origin"]:

    url = git://github.com/you/projectName.git
    pushurl = git@github.com:you/projectName.git
    

    It will still ask for a password when you push, but not when you fetch, at least for open source projects.

提交回复
热议问题