Github local repo with VS code : Too many changes - github

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.

Related

branches of git repo not showing in vscode using local devcontainer

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

When I add a solution to source control in VS 2019 Azure Devops only the startup project gets added - how do I add the others?

I am working on a solution that has 14 projects (so far) in it. I added the solution to Azure Devops source control and can see that the solution and the startup project have the little locks in the solution explorer, also I can see the startup project files in the devops repo, but I can't see how to add the other projects. Obviously I messed up somewhere, since ideally the repo would contain a folder for the startup project rather than the files themselves, but I don't know how to "undo" the source control and reset my solution back to its original state.
Can someone tell me how to either fix the source control so that the master branch contains all of the projects in sub-folders (as per the visual studio folder structure) - i.e. how to move the startup project files in the devops repo to a sub-folder and how to add the other projects to their own sub-folders, or, failing that, how to undo the source control so that all of my solution files are back on my local hard disk?
Any advice will be appreciated.
You mentioned that you are using git. So when you DO NOT have local changes which are not pushed to your git server, that means everything is "synced".
Make a backup of your folder, just copy & paste everything!
You can just delete the .git folder. So you have no "link" to the git server anymore.
You can the link the "folder" again to your git server, with sth. like:
git remote add origin https://YOURNAME.visualstudio.com/YOURPROJECT.git
Other option is check your .gitignore file, maybe some of your projects are excluded.
When you are working with Visual Studio, can can also create a new empty solution and add the projects one by one. Also be sure that there is NO Filter in Project Explorer in Visual Studio.
You can also check your git changes, with git log or git status from any terminal or command line tool.

Connection to Github from VS code fails

I am trying to connect VS code (on win10 machine) to github.
The GitHub Pull Requests and Issues is installed and enabled.
I followed few YouTube guides in which it was mentioned the git button that should appear on the upper right side of the explorer window, in order to add the project to the source control section.
This button doesn't appear at all.
Any idea?
Thank you
Since I post this message, VScode released a new version which makes the connection to Github very simple. For newbies like me that need to establish the connection, you may use the process I use:
1- Create a repository on github, and copy the link to the repo
2- In VScode, in view, command palette: GitClone, then add the link you just copied, select the folder where you want to store the repo on your local drive, and that's it.
3- Use the Source Control button on right, and them stage your changes, commit - and now only push/pull or sync.
Good luck.

Rstudio: Changing origin for git version control of project

I originally set up git in Rstudio while enrolled in the Data Scientist's Toolbox course at Coursera. Unfortunately, I did this in my phd project. The repository no longer exists on github. I am now attempting to write my thesis in rmarkdown using knitr and bookdown. I would like to use version control, both to learn proper git workflow and to have a structured back up of everything I have done in my thesis. However, I have been unable to change the version control repository in Rstudio.
I am unable to change this in the Tools > Version control > Project setup > Git/SVN menu. The Origin: textbox is unchangable.
I tried creating a new project using the old phd project's working directory. This also cloned the version control settings.
How do I change the origin to accomplish what is described above?
Git, Github and Rstudio are different things. You could use git as local version control tools. You might connect your local repo to Github account which is based on git by push/pull. Rstudio just makes a user interface for git and supplies the function to push the repo into remote server based on git to make version control(not only Github, but also Gitlab).
So for your issue, if you do not want to pay for github for a private repo, all of your code would be public and I don't think it is good before your finally finished your thesis. But version control could be made locally with git only. Just use git shell to control the version.
However, as a student, github could support private repo here for you. Just register and find your student package. Then just remove the url for remote repo after you cd to your workdir in command line, use the following code to find your remote url(mostly you might fing origin):
git remote -v
Then use this to remove them:
git remote rm origin
Now you could use version control locally. If you want to connect this repo to your remote github private repo, use this:
git remote add origin https://github.com/[YourUsername]/[YourRepoName].git
RStudio would find this information about git and support your following operation. Project in RStudio is different with git, although project support git as version control tool. So you need git in command line or shell to solve your problem.
This can be done by opening /your.project/.git/config
and editing the remote origin line(s), e.g. changing from git to https.
Restart Rstudio & you'll be prompted for your github username & password.
This is what worked for me for migrating from github to Azure
Go to the top right Git window in RStudio and click on the gear. Now click Shell (to open the terminal there).
#remove origin
git remote rm origin
#add new origin like Azure for me via HTTPS
git remote add origin https://USER#dev.azure.com/USER/PROJECT/_git/REPONAME
#push your local repro
git push -u origin --all
#in my case put in the PAT password if you needed to generate one.
After testing, I found some clue
Actually Rstudio is not really smart about this setting
It will first search for the git file in the Rproject folder where your Rporject file is located
if it could not, then it goes up to the folder contains your Rproject folder
However, for version control you only need coding files while RProject may contains some big files like .RData some pictures etc.
I don't find a way to manually disrupt this logic flow, the only thing you can do is to delete the current git repository setting files(which is .git folder and 2 other git setting files), then Rstudio may ask you if you want to init a new one.

How to use Egit with ssh

I have always used gitHub as my repository but now I decided to store my source code into my local server (Ubuntu 14.04).
I use Eclipse as IDE and to make it working with git I installed Egit plugin.
My objective is to have a centralised repository in my local server at 10.3.16.1 and use my desktop pc and my macbook to push and fetch data from it.
My existing maven spring web based application sits at the moment on my laptop (eclipse)
I created a local git repo and then I added and committed all files. (so far so good)
Afterwards, I created a new remote as follow
I then pushed the master branch to the server but despite it says that the process has been successful I cannot clone the entire source code from my pc but only metadata like commits etc but not source files
Any thoughts on this?
Thanks
I managed to solve this problem on my own.
Apparently Git does not store source files in the centralised repository but only objects.
In order to import all source files I did the following on my PC
In eclipse File-> Import-> Git-> Project from Git
Then I selected Clone URI
I filled the location of the repository as follow
Eclipse retrieved successfully the master branch
Set the local destination of the new repository on my pc
And then I imported all sources accordingly as follow
Then I added the project to my working set
Hope this can be of help