Github 当我提交更改时,VScode不会自动推送

Github 当我提交更改时,VScode不会自动推送,github,visual-studio-code,Github,Visual Studio Code,我可以提交大量的更改,但没有任何内容可以访问github 只有当我从推送到github的菜单中手动单击推送功能时,才会出现这种情况 我如何让它在我提交时自动执行此操作 以下是我的VS GIT设置: // Whether git is enabled "git.enabled": true, // Path to the git executable "git.path": null, // Whether auto refreshing is enabled "git.

我可以提交大量的更改,但没有任何内容可以访问github

只有当我从推送到github的菜单中手动单击推送功能时,才会出现这种情况

我如何让它在我提交时自动执行此操作

以下是我的VS GIT设置:

 // Whether git is enabled
  "git.enabled": true,

  // Path to the git executable
  "git.path": null,

  // Whether auto refreshing is enabled
  "git.autorefresh": true,

  // Whether auto fetching is enabled
  "git.autofetch": true,

  // Confirm before synchronizing git repositories
  "git.confirmSync": true,

  // Controls the git badge counter. `all` counts all changes. `tracked` counts only the tracked changes. `off` turns it off.
  "git.countBadge": "all",

  // Controls what type of branches are listed when running `Checkout to...`. `all` shows all refs, `local` shows only the local branchs, `tags` shows only tags and `remote` shows only remote branches.
  "git.checkoutType": "all",

  // Ignores the legacy Git warning
  "git.ignoreLegacyWarning": false,

  // Ignores the warning when there are too many changes in a repository
  "git.ignoreLimitWarning": false,

  // The default location where to clone a git repository
  "git.defaultCloneDirectory": null,

  // Commit all changes when there are not staged changes.
  "git.enableSmartCommit": false,
根据GitHub上的信息,此功能不存在,也不打算添加

他们建议使用来实现这种行为

大概是这样的:

#!/usr/bin/env bash

branch_name=`git symbolic-ref --short HEAD`
retcode=$?

# Only push if branch_name was found (my be empty if in detached head state)
if [ $retcode = 0 ] ; then
    #Only push if branch_name is master
    if [[ $branch_name = "master" ]] ; then
        echo
        echo "**** Pushing current branch $branch_name to origin ****"
        echo
        git push origin $branch_name;
    fi
fi
您可以查看更多详细信息和选项