
VS Code just uses your environment's git configuration when it commits and pushes to the remote repo. Git remote set-url origin /your_user/your_project.gitįrom now on you can easily do git push from the terminal or Visual Studio Code. After this, go to your Git project directory and this enter in the terminal: Make your access control selections, generate, then copy and save your new token. This feature can be set up by going to your GitHub account → Settings → Developer settings → Personal access tokens → Generate a personal access token. While Git over HTTP with OAuth reduces friction for some types of applications, keep in mind that unlike deploy keys, OAuth tokens work for any repository for which the user has access.A simpler method is to use personal access tokens at GitHub. We’re excited to expand our support of HTTP transport using OAuth. Instead, just use the full git URL in your push/pull operations: mkdir foo To avoid writing tokens to disk, don’t clone. We decided to use the token as the HTTP username to avoid colliding with credential helpers available for OS X, Windows, and Linux. Unfortunately, this happens for HTTP passwords, too.

Putting the token in the clone URL will result in Git writing it to the. If you’re cloning inside a script and need to avoid the prompts, you can add the token to the clone URL: git clone git clone Tokens should be treated as passwords. Next, you can simply use an OAuth token for the username and either a blank password or the string x-oauth-basic when cloning a repository. Remember, you’ll need repo scope to access private repositories. You can create a token via the Authorizations API or web flow. To use OAuth instead, you’ll need an OAuth token. When using Git over HTTPS for private repositories, you use your GitHub username and password which are passed to the server using Basic Authentication.

Today, we’re bringing the benefits of OAuth to our HTTP transport stack for Git operations.

Deploy keys have been the preferred way to delegate access for these types of services, and unfortunately they do not work with HTTP transport. When requesting access, applications declare the level of permissions they need, and tokens are created with the appropriate scope as granted by the user.ĭeployment scripts and continuous integration services that need to clone and fetch private repositories haven’t seen the full benefit of HTTP transport because it requires a GitHub username and password for private repositories.

Tokens can be revoked at any time from a user’s settings screen in GitHub. Unlike usernames and passwords, OAuth tokens provide additional benefits: We first introduced OAuth2 tokens in the GitHub API starting in v3.
