branches of git repo not showing in vscode using local devcontainer - git-branch

I have a repo on github configured with codespaces. When opening codespaces on github in the cloud everything works and I can easily switch between branches.
Now I checked out the same repo locally on my windows machine an opened it with my local installed VScode. Again everything normal, and I can easily switch between different branches.
VScode now offers me to reopen in a devcontainer. I choose to do so and VScode starts building my local devcontainer, installing... After a while my devcontainer is ready and I can modify code and build (branch available is the one last used on the windows side). So far so good. However now I can not change branches in VScode anymore. Also when I click on the Git icon on the left of VScode I get a message saying:
The folder currenlty open doesn't have a git repository.
However in the terminal of the devcontainer I see my complete git repo (with all the git files) that is mounted from Windows. Changes done in the container are immediately reflected on Windows and vice versa as well (just checked this to make sure that it is properly mounted).
Any help is very welcomed.
Regards
Marc

Related

How to open your own github repo from github.dev

In the new product of Microsoft, github.dev, you are automatically forwarded to a VSCode web IDE. However, I am not sure if it is possible to open your own repo (hosted on github.com), work on it and push the changes. Can you help explain if this can be done and how?
I do not seem to find a straightforward tutorial on that.
Note that I was able to open a repo of mine by clicking on the blue GitHub icon in the bottom left corner, but I fail to install a terminal, because
Terminals are not available for web editor. To use terminal you need to continue working in an environment that can run code, like codespaces or local VS Code
I read that codespaces are a paid option for github enterprise, but the way this error message is written might suggest other ways.
Opening your repository
You can open your repository by visiting it's page on GitHub and pressing . to open it in github.dev. You can also use the url format https://github.dev/<username>/<repo-name> with the path to your repository.
Making Commits
While the terminal cannot be used in the editor, you can make commits using the VSCode source control system.

Git Repository not Detected in Remote VS Code Workspace

I set up VS Code's Remote - SSH extension to edit ROS projects on remote Linux machines over SSH. I'm able to view and edit code directly on the remote machines, but I'm unable to use any of VS Code's built-in git/source control functionality.
My understanding is that when I'm in a remote workspace with a .git directory, VS Code should automatically detect that the workspace is a git repository. In my case, the source control pane in the side bar does not acknowledge that I'm in an existing repo, but instead offers to initialize git. Screenshot here
I'm definitely in a git repo, as I'm able to interact with git through VS Code's terminal just fine.
Additionally, once connected to a remote SSH workspace, if I select "clone a repository" from VS Code's welcome screen, I get the error: "It looks like git is not installed on your system."
I know that the issue is isolated to the Remote-SSH connections, as I'm able to use the built-in source control features without a problem on local projects, and I've disabled all other extensions.

Github local repo with VS code : Too many changes

I have install Github Enterprise on a self-managed server. I am connecting to my Github repo through VS Code. Every time I open VS code:
1 - It's trying to connect automatically to my cloud repo (Which I would like to be able to manually connect)
2 - VS code is installed in Anaconda and it's detecting 5000 changes....all anaconda files on my local machine
Can anyone help me with this issue?
thank you
I guess you have Anaconda or a conda environment installed into your project folder? Then you have to add that folder to your .gitignore file.
In VSCode you can rightclick on one of the 5000 files, select "Add to .gitignore" from the context menu, then the file .gitignore opens and you can delete everything but the top folder from the new entry and then that folder will be ignored.
Btw., VSCode doesn't update your local git repository automatically but just checks, if there are new changes in your remote repo (github) or how far it is behind your local changes. You can see that in the VSCode status bar. If you want to actually change one of the repos you either have to "pull" or "push" manually.

How to use GitHub for Windows 2.0 with non-GitHub repositories

I just installed (as opposed to update) GitHub for Windows 2.0 and for the life of me I cannot find how to use it with non-GitHub repositories. In the past I have done this without issues using this guide. However with version 2.0 the layout has changed and I cannot find a UI to clone a repo that is not from GitHub. I guess I have to drop to the command line but I have no idea how to use git that way.
As you suggested, you can clone the repository with Git on the command line. To do so you can execute the following steps:
Start the Git shell (Start menu->GitHub, Inc->Git Shell on Windows 7, I'm not familiar with Windows 8 but I think it will show up when you type "Git Shell" on the start screen)
Make sure you are in the GitHub directory (C:\users\\Documents\GitHub). Otherwise use the cd-command to navigate there.
Use the clone command git clone user#domain.com:/path/repository.git with the clone-url for the project you want to add. (More information about cloning)
Start GitHub for Windows and go to tools and options->Options
Click Scan for repositories, if everything went right your cloned project shows up.
Make sure it is selected and click Add

EGit greying out / not showing commit

I've been running into a wired problem (which has been described (but not solved) here as well:
I used to develop using PyDev and Egit (recent versions, EGit is 3.0.3) with just a local repository. Everything worked fine, I was able to commit, branch, reverse etc. just using the "Team" menue in my PyDev perspective.
Now I added a remote reposisory to host the project and since then, I can not commit to my local repository. File changes are not detected (even worse: I change file A and afterwards all folders are marked as "changed" (having the ">" icon) and no file is recognized as "needing synchronization". The only menu points which are available are "Add to index" (which has no effect) and "Pull" (which says "everything is up to date" - which is true since there is nothing new on the server to pull).
When I use git (either command line or git extensions), I see the changed file as changed and it's offered for staging. I can use plain git to commit, push, etc, everything works as expected and no error messages are shown. I'm just using one branch (master).
Even if I open the "Git Repository Exploring" perspective in Eclipse and got to the tab "Git Staging", the file is listed.
I jus started a new test project with just a local repository (residing in the same git-folder ~/git) and here I can commit as I'm used to... And I added the project to the same repository server - and still everthing works! I can commit, I can push, everything is fine there...
yes, I can work around hat by using git extensions, but I really liked the smooth integraion of git in eclipse. Therefore, all ideas, remarks etc. are very welcome! And yes, I tried restarting eclipse ;o).
Finally!!!
Since everything was working before I added the remote host, amd everything worked in my small toy project, I removed and re-added my remote host using gut bash:
git remote remove origin
git remote add origin git#my_servername:my_repository.git
I suppose some configuration files were corrupted in a very non-obvious way (I checked all config fiels and did not notice anything...)
Sounds like a bug, and you might be able to get it back to a good state by playing around with the plugin setting data.
Located here: ${workspace}/.metadata/.plugins
I highly recommend backing up that whole folder before you start playing around. I have had other eclipse issues that have been resolved by going in here and deleting things.