The message keeps saying uploading files "forever". What I did was created a folder with a file inside. On Github, the repository was created successfully but the file is not uploading. And yes I have installed git.
The repository created successfully but the files are not uploading.
If you have the latest Git for Windows, chances are you have a git config credential.helper set to manager-core.
As I mentioned in "After $git push -u origin main command, Git bash is not requesting any authentication literally does nothing", the same issue is seen in command-line, not just VSCode.
This is because of the Git-Credential-Manager-Core (interface to the Windows Credential Manager, in charge of caching your credentials: GitHub username/token).
Try and install the last GCM-Core (released yesterday), and see if the issue persists then.
Or, alternatively, you could use an SSH URL, again, to see if the issue persists.
What fixed it for me:
In VSCode: File -> Preferences -> Settings.
Filter for "git".
Select "git (80)" on the left pane.
Uncheck this:
Git: Require Git User Config
Controls whether to require explicit Git user configuration or allow Git to guess if missing
Related
I was trying to upload one of my Jupyter Notebook files on GitHub, but it's taking forever to upload.
File size is also not that big. It's about 17KB. Also getting problem for this notebook only.
Here's the screen shot.
Any kind of help or suggestions are highly appreciated.
Try using Git Bash to push your code/make changes instead of uploading files directly on GitHub (it is less prone to errors and is quite comfortable at times - takes less time as well!), for doing so, you may follow the below-given steps:
Download and install the latest version of Git Bash from here - https://git-scm.com/
Right-click on any desired location on your system.
Click “Git Bash Here”.
git config --global user.name “your name”
git config --global user.email “your email”
Go back to your GitHub account – open your project – click on “clone” – copy HTTPS
link.
git clone PASTE HTTPS LINK.
Clone of your GitHub project will be created on your computer location.
Open the folder and paste your content.
Make sure content is not empty
Right-click inside the cloned folder where you have pasted your content.
Click “Git Bash Here” again.
You will find (master) appearing after your location address.
git add .
Try git status to check if all your changes are marked in green.
git commit --m “Some message”
git push origin master
Hope this helps! Good luck!
You could try and:
clone the repository, add the file locally, commit and push
check on github.com if your remote repository has a .gitattributes file with lfs directives in it.
Maybe that repository, managed by LFS, has reached some upload limit which would prevent any new upload.
I have 2 different GitHub accounts: A personal account for my own needs, and a company GitHub account that I manage. I use V.S. Code for both company & personal projects, and I was hoping to find an answer to the following question.
Is it possible to log into two GitHub accounts at the same time in V.S. Code? If not, then does someone know if V.S. Code has a quick and easy mechanism built into its UI for switching between GitHub accounts?
LIST of MAJOR REVISION DATES
EDIT 1: 2021-06-06
•
EDIT 2: 2021-07-15
•
EDIT 3: 2022/05/21
This question has been edited several times to keep it useful, and current. The most recent edit was on September 14th of 2022 at approx 10am UTC. There have been 3 major edits (or revisions is probably the more appropriate term to use here), that were necessary in order to keep this answer relevant and up to date. The revisions were prompted by changes to the UI and changes to GitHub's own defined protocol that defines the login process (I am specifically referring to GitHub now requiring a PAT security token to be used to authenticate anything pushed using the HTTPS protocol). The most important thing to note is as of 2022/09/14, this is a working answer.
This Q&A Contains 2 Questions.
The first question can be answered very quickly, whereas, Question-#2 will require far more explanation and contains the answer that you'll likely be looking for.
The 1st question ("Question #1") asks:
Is it possible to log into two GitHub accounts at the same time in V.S. Code?
ANSWER #1
No! You Cannot Log into 2 GitHub Accounts at the Same Time.
The 2nd question ("Question #2") asks:
(Q) Does V.S. Code have a quick & easy mechanism built into its UI for switching between GitHub accounts?
(A) YES IT DOES! VS Code has an icon on the "activity-bar" that can be used for logging in & out of your GitHub & Microsoft accounts. I will go into detail about this below.
Step-1: Install the Following Extensions
You should have a couple extensions that help to automate the login process, which now requires a PAT (even in the CmdL). And that also help with organizing the user.name and user.email that you use for each project. Bellow are the 2 extension you need.
"GitHub Pull Requests & Issues Extension"
Link to open in VS Code: vscode:extension/GitHub.vscode-pull-request-github
REASON 4 INSTALLING - This is a GitHub extension that everyone using GitHub should use, but it also does something to help with Terminal integration that enables UI and CLIs to co-exist. The last sentence was nearly word for word from the extensions description. To be more concise, installing it will help to automate the login process to GitHub. Upon installing it will likely prompt you to log into GitHub. If that is the case, then YES LOG IN
GIT-AutoConfig
_"Git-Autoconfig automatically sets credentials for each new project you clone, &/or create. It also prompts you when you open your projects to make sure that the project is configured with the correct user.name & user.email. When using two GitHub accounts it is critical that you configure each project specifically for the account it belongs to. If a project accidentally gets configured for the wrong project, bad things happen, and lots of time is wasted.
This extension needs to be configured. The extension attempts to auto-configure each project, but in-case, you feel a project isn't configured, or is configured incorrectly, you can hit the F1 key to drop open the "Quick Input Menu". With the menu open, type "git autoconfig set". When you see an option that reads, "Set Config", select it, and follow the 2-part instructions.
A HELPFUL TIP:
When "Git-AutoConfig" prompts you, if the setting below is configured in your user-scoped "settings.json" file, then you can select a pr-configured input, rather than manually typing the input each time.
/**
* #file "settings.json"
* #desc "This is what my configuration looks like" */
"git-autoconfig.configList": [
{
"user.email": "W3Dojo#gmail.com",
"user.name": "jD3V"
},
{
"user.email": "AndrewJay.zck#gmail.com",
"user.name": "JAYD3V"
}
]
Restart V.S. Code
Before continuing to Step-2, please restart your editor, so the menu we use below recognizes the GitHub extension you installed.
Step-2: Configuring your Git settings using the Git CLI
We are going to continue forward from the Welcome Page, as being in a project configured for the wrong GitHub account can screw something up. FYI, you want to make sure you are logged into the correct account when bouncing from one project to the next. You don't want to enter a project for one account, when your logged into another account. It can really confuse VS Code, and even more so, VS Code Extensions. Oh, and Git, the software that VS Code uses to make all of this work.
To get to the Welcome page, preform the following steps:
Choosing "FILE" from the title-bar menu.
Choose "CLOSE FOLDER" from the file-menu.
You should now be at the VS Code welcome page, this is a good neutral place to start.
It might sound like I am being finicky, but I want this to work for you, and anything involving Git, can get screwed up very badly, very easily.
Step-3: The Account Context Menu
We will use the "Account Context Menu" to log out of any GitHub accounts your logged into. Click on the icon located at the very bottom of your Activity-bar.
The image below shows the selections to choose for logging out. If you are not logged into any GitHub accounts, then thats fine. Just carry on.
Step-4: Configuring Git
In your head, think of the GitHub account your going to log into.
Now, execute the following commands with the correct values for the account you are going to use to log in.
~$ git config --global user.name "urGitHubUsrName"
~$ git config --global user.email "urGitHubEmail#foobar.com"
~$ git config --local user.name "urGitHubUsrName"
~$ git config --local user.email "urGitHubEmail#foobar.com"
Step-5: Logging In
PLEASE NOTE: You are going to log in twice!
First, Click the "Account Context Menu"
With the menu open choose the option that says "Sign-in to Sync Settings" as shown in the image below.
It will let you choose between signing in with Microsoft or GitHub. With this login, you can choose either, but I by far perfer to use my GitHub account, as I use Linux. Depending on what you have done in VS Code in the past, you may need to use to copy & paste a PAT for authentication.
After signing in to MS/GH for syncing settings, Click the "Account Context Menu" again. This time choose "Sign-in: GitHub Pull-request & Issues". Follow instructions. Image bellow shows both options
Now the reason I had you use the settings sync with the GitHub Pull-request & issues extension is for two reasons.
If you use a different GitHub account for each one, you will be auto-logged out of the other. In other words, if you log into the GH extension using account A, while you already logged into settings sync with account B, account B gets logged out. This isn't all, it creats confusion, trust me when I say you want to avoid the confusion when your working in your projects.
Each GitHub account has its own settings synced for it. This includes settings, keybindings, snippets, ect... This way if you have one for work, and one for personal, you can manage different settings. Usually a Company GitHub account will be used by other people in the compant, meaning you will have to use certain settings. This method will prevent you from having to change your personal configuration.
LASTLY
To login to another account, just repeat the steps. It may seem slow the first time you do it, but I log in and out in literally, about 10 seconds now. Cheers from Nor Cal!
Was struggling with this too, but found an easy, natural solution.
Tested with VSCode 1.61.1 and 1.61.2 (Windows 11) and WSL2 (Alpine)
Define some aliases in ~/.ssh/config
Host *github*
HostName github.com
User git
Host perso-github.com
IdentityFile ~/.ssh/id_rsa_perso
Host pro-github.com
IdentityFile ~/.ssh/id_rsa_pro
Make sure you ssh keys are added in your github accounts:
Personal Account (git_perso_account) : ~/.ssh/id_rsa_perso.pub
Professional Account (git_pro_account) : ~/.ssh/id_rsa_pro.pub
Clone your repositories as follows
(or edit their .git/config afterwards to make sure their remote "origin" url matches the alias defined in your ~/.ssh/config file)
➜ ~ # cd repositories
➜ repositories # git clone perso-github.com:git_perso_account/some_fun_repo.git
➜ repositories # git clone pro-github.com:git_pro_account/boring_business_repo.git
Remove git global user config
➜ repositories # git config --global --unset user.name
➜ repositories # git config --global --unset user.email
Note: It might not be necessary as git --local settings are supposed to override --global settings
Add your github account informations in each repository
(Git-Autoconfig might help here in the future)
➜ repositories # cd some_fun_repo
➜ some_fun_repo git:(master) # git config --local user.name git_perso_account
➜ some_fun_repo git:(master) # git config --local user.email perso#gmail.com
➜ some_fun_repo git:(master) # cd ../boring_business_repo
➜ boring_business_repo git:(master) # git config --local user.name git_pro_account
➜ boring_business_repo git:(master) # git config --local user.email you#business.com
Et voilà !
You can now manage your repositories both from the command line and VSCode GUI !
Idea: Configure git in the folder where you work on your PC with SSH keys to authenticate your pulls or pushes. You will need to therefore create SSH keys for each of your Github account for each of your PC.
Let's say you have 2 Github accounts:
work_github
personal_github
and let's say you work from Ubuntu and windows interchangeably. Then you would need to create 4 keys as follows:
key_generated_on_windows_for_accessing_work_github_from_windows
key_generated_on_windows_for_accessing_personal_github_from_windows
key_generated_on_ubuntu_for_accessing_work_github_from_Ubunutu
key_generated_on_ubuntu_for_accessing_personal_github_from_Ubunutu
Step 1: create SSH keys
for windows(use powershell or gitbash or vscode terminal) and ubuntu
ssh-keygen -t rsa -C "your_email"
Step 1.1: when you are faced with this question:
Enter file in which to save the key (/c/Users/your_username/.ssh/id_rsa):
enter an identifiable name, with the full path. For e.g.:
/c/Users/your_username/.ssh/id_rsa_yourname_work_github
you can skip the passphrase by leaving those empty
Repeat this step for both the github accounts for each PC
Step 2: add your public key to github
creating ssh key creates 2 files.
One public - for e.g. /c/Users/your_username/.ssh/id_rsa_yourname_work_github.pub
and One private - for e.g. /c/Users/your_username/.ssh/id_rsa_yourname_work_github
open the .pub file in your favorite editor and copy the entire contents of file including your email.
Go to your github account > Settings > Deploy keys > Add deploy key
paste the copied contents into the "key" text field and give it a recognizable title. for e.g. "windows_your_username" so you know this key will authenticate you from windows PC
Add deploy keys in both the github accounts for all the keys you created on both the PCs.
Final step: configure local git to use the right key and test the access
go to your working folder (or the cloned folder)
open terminal (or powershell) and make VScode(refer here for other editors) the default editor to open git config file
git config --global core.editor "code --wait"
open git config file
git config -e
under [core], add the ssh command with private key path, for e.g.
sshCommand = ssh -i ~/.ssh/id_ra_yourname_work_github
add [user] and add your github username and email
point the remote url to your repository if it isn't already so
You can also use the git command line tool to configure these, instead of editing it in an editor.
that's it. Make a change, commit and try pushing it to github repo.
Repeat this step for all working folders on your PC.
You should now be able to work with different Github accounts on the same system
Confession: All credits for this answer is attributed to this article here.
Tried a bunch of options, but settled on this strategy. I am using a Windows machine.
Install WSL
Install VSCode Insiders Build (I think you can get away with using only one VSCode instance, but I wanted to use two)
Setup one of your git config on your WSL terminal
Follow the WSL on VScode instructions and install the remote developement extension pack on your insider version of VS Code.
Open VSCode (insiders) from your WSL terminal using the command code-insiders or you can open VSCode (Insiders) then press ctrl+shift+p for opening the command palette then running the command WSL: Open Folder in WSL
That is my solution so far. I wish there was a toggle to switch profiles entirely as of writing this comment, I wasn't able to find a solution.
There is also the Git Config Profile Extension but I wasn't able to make it work. I think I have to set up the git config files properly.
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.
Started getting following error in Sourcetree suddenly. I dont know what is the reason behind it. but I am nit able to resolve it.
Not able to perform any operation.
I ran into this as well. I followed the steps here and it solved my problem:
https://jira.atlassian.com/browse/SRCTREE-2018
Specifically:
Using the terminal and changing your directory to your repository you can do the following (making sure you back up your repository first, just in case):
rm .git/index
git add .
Or if you have changes in your working directory you want to keep you can do the following:
rm .git/index
git reset HEAD .
I had the same issue and it was not fixed even if I deleted the .git/index and .git/index.lock file.
I had to go to SourceTree Options -> Git and select "Use Embedded Git" to make it work. Before it was "Use System Git".
This is happening because Git was installed and then SourceTree with Git inside.
This generated a conflict between the two installed GITs.
You need to uninstall Git or in the SourceTree installation point where it is installed.
I'm facing with the same issue. My software configuration is:
Windows 10
SourceTree 2.0.18.1 configured to use System Git version
Git v2.12.2.windows.1
I updated Git to v2.12.2.windows.2 (the latest build) and the problem
disappeared.
Try doing this
close Sourcetree window
open Sourcetree Bookmarks view
delete bookmark
add bookmark again
I have: http://windows.github.com/
My current project has around 20k files, around 150MB (and not speaking about how slow it is and I cannot do a thing now) it doesn't even let me commit! I get this error: Commit failed: Failed to create a new commit.
That seems that nobody is having.
I've already deleted the folder and cloned again, no escape. What to do?
If I choose to open shell, all this *** crashes!
Edit:
Since the problem I've switched to Git Extensions and I didn't look back!
thanks for your answers
This happened to me. Try opening up PowerShell and manually committing each file using the "git add [file name]" command. To see which files have been added, enter "git status" into the command line. The green files have been added, the red ones have not been added.
Once you've added them all, type "git commit." Then go back to Github for Windows and sync it up.
I'm not sure what causes this issue, but once I followed the above steps, Github went back to its normal, awesome behavior.
I had this problem too after an unexpected crash. I couldn't fix using the 'Open Shell' option as suggested. I had to open the Windows CLI (Start -> run -> cmd) and delete the index.lock file in my GitHub folder:
cd \Users\myUser\my\local\github\repo
cd .git
del index.lock
Then when I went back to the GitHub app, it committed successfully.
Note that for some people, according to comments, the file to delete doesn't have the .lock extension, so the delete command could also be del index.
Im using Githug for Windows (7) and faced the same problem. While using PowerShell I realized that I didn't fill Full Name and email address in tools > options. Look like a beginner mistake (and I am!).
hope it helps!
just try to commit a few from your updates. 5 for example. and then make another commit with all other updates.
I am using windows client and getting the same error. Then suddenly I realized that my local db in app_data was opened on the SQL management. It just simply can't commit the some files to github if they are opened or using at the other programs.
Just disconnected management studio closed it and just simply committed.
This may be your case also. Check your files out!
So guys this is the full steps I had to take in order to fix the problem...
1) Using Process Explorer (you can download it form here http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx) I searched for any process referencing ".git\index" and then I killed it.
2)Then using Git Shell (Windows Power Shell) I went into the repository which was giving me such difficulty and then furthermore went into its .git folder. (cd .\your_respository_name\.git). I then removed the index.lock file in that directory (rm -r index.lock).
3)Then from within that same directory I ran git reset HEAD.
4)Then I manually committed each file using the "git add [file_name]" comand. (You can check that they were added successfully if when you run git status, the files are green.
5)Next run git commit if your files are added correctly.
6)Finally go back to github for windows and sync everything up and it should hopefully work and resolve the problem.
This issue seems to be a bug in the github client - I get it "all the time" on the machine on which i only installed the github client.
I Never saw it on the git + github PC (I have not used it for a few days now).
Doing the "git add ." and then "git commit" worked for me also on the shell - but that is the thing the GUI should be doing not me - otherwise I can just stick to the git shell client.
Had the same problem, couldn't commit or sync using the windows GUI, but I could commit the changes through the shell. Once I'd added the changes through the shell the windows GUI started to sync normally. Hopefully it's a one off.
I had an interesting issue - even though I had an excel file open called "Combined - ForImportv4.xlsm", Git UI had no problem checking that in but it gave the error in the OP's subject for the backup file "~$Combined - ForImportv4.xlsm" so I discarded that change and all went through.
PS: As for why i'm checking an Excel file into Git ... just don't got there :)...
I had this issue with the git windows desktop commit tool. I was getting this often and I figured out that Visual Studios was locking the files. To get around this issue I simply closed visual studio and the commit / sync worked fine.
I googled failed to create repository and ended up here.
My problem was that the description for my new repo was too long. There is a charlimit for the description, but GitHub tried to push it anyway and failed.
I just had the same problem, tried some of the suggestions on this post but none worked so what i did was, on the GiTHub client i went to tools -> settings and then click on the section where it says add/create default ignored files. Then hit Update and try to commit again through the client.
It happend to me when my project was opened in an IDE (Netbeans in my case), make sure non of the files you're about to commit isn't open in some program.
I checked the log file at C:\Users{user}\AppData\Local\GitHub\TheLog.txt and found this error:
LibGit2Sharp.LibGit2SharpException:
Could not open 'SomePath\SomeProject.opensdf':
The process cannot access the file because it is being used by another process.
I closed Visual Studio and the commit was then created successfully.
n.b. I removed actual file path in the above error.
If you are new user make sure that you have confirmed your e-mail. Had same problem and confirmation fixed it!
You can manually navigate to index.lock which is found inside the hidden .git folder of your repository location. Once you delete index.lock you will be able to commit as per usual.
The easiest way to navigate to the folder will be to click on the folder breadcrumbs inside windows explorer and add \.git and press enter.
Just delete 'index.lock' in the '/.git/' directory. Solved the problem for me instantly.
I had this happen to me and this is the easiest way to fix it:
Make a copy of your local folder that has the repo and remove the .git folder form it.
Delete the original repo folder with files.
Re-clone the repo from GitHub with the Windows client.
Delete all of the files that get cloned except for the .git folder.
Copy all files from the copied folder into the new clone folder.
Add in your commit notes and the commit should work this time.
I had the same problem and I fixed it by renaming one of the file because its name was too long. This fixed the problem.
Here is error message from git shell:
fatal: unable to stat 'plugins/com.napolitano.cordova.plugin.intent/example/app/platforms/android/CordovaLib/build/intermediates/classes/debug/org/apache/cordova/NativeToJsMessageQueue$OnlineEventsBridgeMode$OnlineEventsBridgeModeDelegate.class': Filename too long
I REBOOTED my Windows 7 machine and tried again - IT WORKED!
I had the "Commit failed: Failed to create a new commit" and tried to delete the index or index.lock file via windows command prompt and that didn't work. I deleted it via windows explorer, that didn't work.
I tried to check credentials like another reply in this list said, but couldn't figure it out and the credentials seemed 'ok.' So - I rebooted. Viola.
I'm not sure this will help anyone, I'm not all that great w/ this stuff, but trying.
I deleted ".git" in children directory and the problem was resolved.
It happened to me once ,I had a empty repository inside of the repository that I cloned.
It was a silly mistake though but could happen .