Prep a Folder to Upload to Github
This browser is no longer supported.
Upgrade to Microsoft Edge to take reward of the latest features, security updates, and technical back up.
Set up Git repository locally for documentation
This article describes the steps to set up a Git repository on your local machine, with the intent to contribute to Microsoft documentation. Contributors may use a locally cloned repository to add together new articles, practice major edits on existing articles, or change artwork.
You run these one-time setup activities to showtime contributing:
- Make up one's mind the advisable repository
- Fork the repository to your GitHub account
- Cull a local folder for the cloned files
- Clone the repository to your local machine
- Configure the upstream remote value
Important
If you're making only minor changes to an article, you do non need to complete the steps in this article. You tin can continue directly to the quick changes workflow.
Overview
To contribute to Microsoft's documentation site, you can brand and edit Markdown files locally by cloning the corresponding documentation repository. Microsoft requires yous to fork the appropriate repository into your ain GitHub account so that you have read/write permissions there to store your proposed changes. Then yous use pull requests to merge changes into the read-merely key shared repository.
Determine the repository
Documentation hosted at docs.microsoft.com resides in several different repositories at github.com.
-
If y'all are unsure of which repository to use, then visit the commodity on docs.microsoft.com using your web browser. Select the Edit link (pencil icon) on the upper correct of the article.
-
That link takes yous to github.com location for the corresponding Markdown file in the appropriate repository. Note the URL to view the repository name.
For instance, these popular repositories are available for public contributions:
- Azure documentation https://github.com/MicrosoftDocs/azure-docs
- SQL Server documentation https://github.com/MicrosoftDocs/sql-docs
- Visual Studio documentation https://github.com/MicrosoftDocs/visualstudio-docs
- .Cyberspace Documentation https://github.com/dotnet/docs
- Azure .Cyberspace SDK documentation https://github.com/azure/azure-docs-sdk-dotnet
- ConfigMgr documentation https://github.com/MicrosoftDocs/SCCMdocs
Fork the repository
Using the appropriate repository, create a fork of the repository into your ain GitHub account by using the GitHub website.
A personal fork is required since all main documentation repositories provide read-but admission. To brand changes, yous must submit a pull asking from your fork into the primary repository. To facilitate this process, y'all kickoff demand your ain copy of the repository, in which you accept write access. A GitHub fork serves that purpose.
-
Go to the main repository's GitHub folio and click the Fork button on the upper correct.
-
If you are prompted, select your GitHub account tile as the destination where the fork should be created. This prompt creates a copy of the repository within your GitHub business relationship, known as a fork.
Choose a local folder
Brand a local folder to concord a copy of the repository locally. Some of the repositories can be large; up to v GB for azure-docs for instance. Cull a location with available disk space.
-
Cull a folder name should be piece of cake for you to remember and type. For example, consider a root folder
C:\docs\or make a folder in your user profile directory~/Documents/docs/Important
Avoid choosing a local binder path that is nested within of another git repository binder location. While it is acceptable to store the git cloned folders side by side to each other, nesting git folders inside one another causes errors for the file tracking.
-
Launch Git Fustigate
The default location that Git Fustigate starts in is typically the abode directory (~) or
/c/users/<Windows-user-business relationship>/on Windows OS.To make up one's mind the current directory, blazon
pwdat the $ prompt. -
Change directory (cd) into the folder that you created for hosting the repository locally. Note that Git Bash uses the Linux convention of forrard-slashes instead of back-slashes for binder paths.
For example,
cd /c/docs/orcd ~/Documents/docs/
Create a local clone
Using Git Bash, prepare to run the clone command to pull a copy of a repository (your fork) down to your device on the electric current directory.
Authenticate by using Git Credential Manager
If you installed the latest version of Git for Windows and accepted the default installation, Git Credential Managing director is enabled by default. Git Credential Manager makes hallmark much easier because y'all don't need to recall your personal access token when re-establishing authenticated connections and remotes with GitHub.
-
Run the clone command, by providing the repository proper noun. Cloning downloads (clone) the forked repository on your local computer.
Tip
You can get your fork's GitHub URL for the clone command from the Clone or download button in the GitHub UI:
Be sure to specify the path to your fork during the cloning process, non the main repository from which yous created the fork. Otherwise, you lot cannot contribute changes. Your fork is referenced through your personal GitHub user account, such equally
github.com/<github-username>/<repo>.git clone https://github.com/<github-username>/<repo>.gitYour clone command should look similar to this example:
git clone https://github.com/smithj/azure-docs.git -
When y'all're prompted, enter your GitHub credentials.
-
When you're prompted, enter your two-factor hallmark code.
Note
Your credentials will exist saved and used to authenticate hereafter GitHub requests. You only need to practise this authentication once per computer.
-
The clone command runs and downloads a copy of the repository files from your fork into a new binder on the local disk. A new folder is made within the electric current binder. It may take a few minutes, depending on the repository size. Y'all can explore the folder to run into the structure once it is finished.
Configure remote upstream
Later cloning the repository, fix a read-only remote connexion to the master repository named upstream. You utilise the upstream URL to keep your local repository in sync with the latest changes made by others. The git remote control is used to gear up the configuration value. Y'all utilise the fetch command to refresh the branch info from the upstream repository.
-
If you're using Git Credential Director, use the following commands. Replace the <repo> and <organization> placeholders.
cd <repo> git remote add upstream https://github.com/<organization>/<repo>.git git fetch upstream -
View the configured values and confirm the URLs are correct. Ensure the origin URLs betoken to your personal fork. Ensure the upstream URLs indicate to the primary repository, such every bit MicrosoftDocs or Azure.
git remote -fiveInstance remote output is shown. A fictitious git account named MyGitAccount is configured with a personal access token to access the repo azure-docs:
origin https://github.com/MyGitAccount/azure-docs.git (fetch) origin https://github.com/MyGitAccount/azure-docs.git(push button) upstream https://github.com/MicrosoftDocs/azure-docs.git (fetch) upstream https://github.com/MicrosoftDocs/azure-docs.git (push) -
If you fabricated a mistake, you tin remove the remote value. To remove the upstream value, run the command
git remote remove upstream.
Side by side steps
- To learn more about adding and updating content, continue to the GitHub contribution workflow.
Feedback
Submit and view feedback for
Source: https://docs.microsoft.com/en-us/contribute/get-started-setup-local
Yorum Gönder for "Prep a Folder to Upload to Github"