From GitHub Desktop to VSCode
21 Feb 2024
TODO!
Woah
File -> Add local repository
Add local repository
Local path
Choose…
c:\example
! This directory does not appear to be a Git repository. Would you like to create a repository here instead?
(Clicking create takes you to the Create a new repository popup)
Alternative flow to create, if have repos
- “Current repository” tab
- “Add” dropdown
- “Create new repository” button
Alternative flow to create, if no repos
- “Let’s get started” screen
- “Create a New Repository on your hard drive”
Create a new repository
- Name: (not sure yet what to do here; seems to get ignored if local path is grayed out because you clicked through from add a repo)
- Description:
Yay, I made a repo
- Local path:
C:\example
- Leave
Initialize this repository with a README
unchecked. - Leave
Git ignore
set toNone
- Leave
License
set toNone
Click the Create repository button at the bottom of the popup.
Remove the folder’s new .gitattributes
file if you don’t like having such things in your repos.
Publish your repository to GitHub
Click the Publish repository button from the splash screen of the repo.
Or, Repository -> Repository settings -> Remote tab -> Publish button.
First, go to Git config tab, the popup’s bottom one.
Change the radio selection from Use my global Git config
to Use a local Git config
.
Then change the 2 values under Name to match your preferred style. e.g.
my-github-username
[email protected]
If you were to hit Save now, your /.git/config
file would get updated to have 3 more lines of detail in it:
[user]
name = my-github-username
email = [email protected]
But instead let’s go back to the “Remote” tab & click that “Publish” button to bring up the “Publish repository” popup.
Publish repository
Go ahead & leave the “github.com” tab selected at the top, not “GitHub Enterprise.”
- Name:
my-demo-repo
- Description:
my demo repo
- Keep this code private: (checked)
- Organization:
None
Click the Publish repository button.
Once it’s done working, not only will the internet contain a new https://github.com/my-github-username/my-demo-repo
URL that didn’t exist a minute ago, but your /.git/config
file will contain 6 new lines of detail:
[remote "origin"]
url = https://github.com/my-github-username/my-demo-repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
remote = origin
merge = refs/heads/main
F1 -> git
Git: Initialize Repository
Pick workspace flder to initialize git repo in
From the dropdown, yes, choose c:\example
as sugested
Now go to the “Source Control” tab.
Click the “View Git Graph” icon.
Click the Dismiss button in the “Error: Unable to load Commits” / “There are no commits in this repository.” popup.
In the upper right corner of the Git Graph tab, click the gear-shaped icon with a “Repository Settings” tooltip.
In the Repository Settings popup, make some changes:
- Name:
my-example
(Seems to no-op?)
Edit the User Details
- User Name:
my-github-username
- User Email:
[email protected]
- User Globally: (UN-check it!)
- Click the Set User Details button
Your /.git/config
file has now been updated to have 3 more lines of detail in it:
[user]
name = my-github-username
email = [email protected]
Under Remote Configuration:
It says “There are no remotes configured for this repository.”
Click Add Remote
- Name:
origin
- Fetch URL:
https://[email protected]/my-github-username-or-org-name/my-demo-repo.git
- Fetch Immediately: UN-check
- Click the “Add Remote” button.
Click the Dismiss button in the “Error: Unable to load Commits” / “There are no commits in this repository.” popup.
Your /.git/config
file will contain 3 new lines of detail:
[remote "origin"]
url = https://[email protected]/my-github-username-or-org-name/my-demo-repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
Aaaaand … now you have to head over to GitHub.com if you chose an organization name.
See https://stackoverflow.com/a/69811790
Otherwise, you can do F1 -> git
-> Publish to GitHub -> publish to GitHub private repository
(or public repository, if you prefer)
Yes, this is a disappointment compared to the completely in-desktop flow of GitHub Desktop. https://stackoverflow.com/a/77163081
On the other hand, the GitHub.com experience is pretty good and comes with github.dev anyway, meaning you might not even really care to use VSCode from your desktop anyway.