Creating repository in git windows




















This comment assumes that you have done the previous steps before running the command to create the repo. Mind you, some commands in the previous steps won't work on the Microsoft Windows Command line e. But if I find a way around this, I'll update this comment. Please accept my apologies.

Reference Screenshots:. Note: I have identified something that I ignored earlier. I have identified the problem and the issue remains that of Microsoft Windows 10 Command line. Amruth-Smaragdine To be candid I did not notice whether I used single or double quotes during the repo creation via the command line. Now that you've mentioned it, I'll try to create a repo using single quotes before the flower brackets if it fails as it did for you, I'll update my previous comment giving you the credit.

Amruth-Smaragdine I just created a repo using single quotes before the flower brackets and it worked. While typing this comment I realized you said Microsoft Windows 10 command line, I'll try to create the repo with it using single quotes before the flower brackets and see how it goes.

I tried with double quotes because you said it solved it for you but to no avail. Currently, have not been able to solve it. Pending your reply and solution to the problem, I'll update my initial comment to indicate that the procedure will work with Git Bash on Microsoft Windows. Maybe I missed a special character. Amruth-Smaragdine Success! Thanks a ton, ziizium - I am happy that I could contribute something that helps everyone.

HermanNygaard Thank you for your contribution, I'll definitely have a look. Anyone who wants to have their own project. I doesn't work if I just enter my username and wait for the password prompt, or enter my password after my username. I'm not sure why, but the access token worked first time, no stress.

The current methods are depreciated Here's the reference. If you still need to do the whole create repo on github website. Just create repo, git clone and then push. So commands are just useless. Skip to content.

Sign in Sign up. Instantly share code, notes, and snippets. Last active Jan 12, Code Revisions 2 Stars Forks The clone command runs and downloads a copy of the repository files from your fork into a new folder on the local disk. A new folder is made within the current folder. It may take a few minutes, depending on the repository size. You can explore the folder to see the structure once it is finished.

After cloning the repository, set up a read-only remote connection to the main repository named upstream. You use the upstream URL to keep your local repository in sync with the latest changes made by others. The git remote command is used to set the configuration value. You use the fetch command to refresh the branch info from the upstream repository. If you're using Git Credential Manager , use the following commands. View the configured values and confirm the URLs are correct.

Ensure the origin URLs point to your personal fork. Example remote output is shown. A fictitious git account named MyGitAccount is configured with a personal access token to access the repo azure-docs:.

If you made a mistake, you can remove the remote value. To remove the upstream value, run the command git remote remove upstream. Skip to main content. This browser is no longer supported. We can also ask Git about the status of the created repository by running the following command:. At this level, the previously created Git repository is ready to add any brand-new file to the project.

Let's add a minimal HTML page to the working directory "kaizen". The minimal HTML page file is attached to this post in the attachments section at the bottom.

You can download the minimal HTML file from the post attachments and put it in the working directory at the same level of the. Now by running the git status command once more, we will find that Git is aware of an untracked file the first stage that you should stage to be committed in the future.

At this step, the file has been staged and ready to be committed to the local Git repository the third stage. The staged minimal. If you figured out that you want to change the commit message after it has been committed then type in the following amend command:. Then you will be prompt to change the commit message, and when you finish editing the message you can quit by typing: : w q. Once you finish, quit the message editor. You can view history by typing in the following command:.

At this step, we have our commits saved at the local Git repository. Now it's time to create a remote public repository at GitHub and push the changes to it. The steps needed to create a public repository at GitHub are straightforward:. Now let's get back to Git bash on our local system and push the local commits in our history to the remote repository we have just created and copied its URL the fourth stage.

On Git bash, type in the following commands to connect your local repository to the remote one:. The first command will add an origin a remote repository to your local Git and the second one will verify the added repository URL.

Next, it's time to check and pull all the changes on the remote repository to the local one to get them both aligned. Now merge both local and remote histories by running the following command:. The previous command will get the latest commit history on GitHub and merge it with the latest local commit history on your local Git repository with the following arguments:.

Git will prompt for your GitHub credentials then it will show a response that looks like the following screenshot.

If you are working with a team, then your local repository is most likely not updated with the latest remote changes. The last step is pushing the local commits in the local Git repository to the remote one on GitHub by applying the following push command:. You can also view the commit history now to have a visual look for what happened so far on Git by typing in the following Git log command:. At this step, you have a fully working Git local repository that's connected to a remote one, and you will only need to pull remote commits and push your local ones on any subsequent changes.

Connecting Git to an existing source code is very similar to what we described before as initiating a new project from scratch with Git. Before we proceed to the next steps, please make sure that you have a Git installed on your machine. You may also visit this link to download the latest Git for windows. Create a folder where you want to put your local Repository.

In my case, I create a folder named Test Git. To do that, cd to the Test Git folder and use the code to create and initialize a repository. You may also open the actual folder directory as shown below. Now, cd to the test. We will clone our repository using Visual Studio and add some files.

To do that, follow the steps below.



0コメント

  • 1000 / 1000