Error while creating local repository in GitHub - github

I have installed GitHub Desktop for Windows. When i try to create a new local repository using GitHub Desktop. It gives me an error as "Failed to create repository.
An error occurred while creating the repository. You might need to open a shell and debug the state of this repo."

Had the same weird issue. Try this from PowerShell/GitBash:
git config --global user.email "you#example.com"
git config --global user.name "Your Name"
For me, these values were not set because I did not log into my GitHub account during the GitHub Desktop install.
GitHub Desktop auto commits .gitignore and .gitattribute when you create a new repo, so the committing without setting these configs is probably causing this error

Make sure you run Github with sufficient privileges. Try to run command shell as administrator and create repository in it.

Related

Can I push code to GitHub from my local machine while editing on a remote machine?

I use VSCode Remote Development to make changes directly on my project server - this makes testing and debugging much quicker than constantly pushing and pulling from GitHub. However, when I do a git commit and push from VSCode, it appears in GitHub as though it was pushed from my server (using its corresponding SSH key) rather than from my local machine and personal account. This means that any changes I make appear to come from a generic "Server" author and are not attached to my name. I would prefer that any changes I make are reflected under my own name and not the generic server account. Is this possible?
You should be able to run these commands in the integrated terminal:
git config --global user.name "Your Name"
git config --global user.email youremail#example.com

Visual studio code will not let me push anything to my repository

I have created on online repository on github and the repository is set to private. I have some files that i wish to commit and push to this repository using visual studio code. I have successfully cloned the repository to my local device after making the repository public but as soon as I wish to commit any of my changes i get the following error
Git remote: permission denied to <My username>
I have tried entering the following command in the terminal. The username is the username of the person who created the repository.
git config --global user.name <github userID>
But the same error still persists. Like i said the user Id i enter created the repository and i am unsure why it is denying me access to the repository. Do i need to login on visual studio code with my github account and if so how do i do that.
The user.name setting has nothing to do with authentication, only with commit authorship.
Check first your git remote -v output in your local repository.
If it is an SSH URL, and if ssh -Tv git#github.com is working (meaning you have registered your public key on your GItHub account and you see "Hi username! You've successfully authenticated, but GitHub does not provide shell access."), that should work from VSCode too.
If it is an HTTPS URL, the first push from VSCode should trigger a popup, for you to enter your username/password.
Note: if you have 2FA activated, that would be your username/PAT (Personal Access Token)
That should then be cached by your credential helper (check git config --global credential.helper)

Cancelling Version Control in Xamarin Studio while sharing with Github

initially i was trying to commit a project to github , then accidentally i didn't commit the project well, now am trying to remove Version Control and switch it again to Commit the project to Github.
I want to see this :
But am seeing this :
How can i Commit again , to github?
I recently just had this problem and asked the wonderful people at Github.
Note: I reset up a new repository, to commit to. I deleted the old one I had messed up. But still could not use Xamarin to Publish. Even after changing the remote connection in version control to the new repository.
This was the solution they provided me with:
From Github
I'm not familiar with the tool that your using to push to the repository but I can help you do this via the command line if that works for you?
Once we get the project pushed to GitHub I think should be able to clone it again to a fresh location on your computer and then link this into Xamarin hopefully.
The steps to push this from the command line would be:
Open the Terminal app and change directories to the location of the project on your local computer.
The command to change directories would be cd <full path to the projects location>. For example if your project was located in your documents folder
cd ~/Documents/projectname
Once there, you need to initiate the project for git version control, commit the project and link up the GitHub repository. To do that you can run the following commands one after the other:
git init
git add .
git commit -m `First commit`
git add remote origin https://github.com/yourrepository/project.git
The last step would be pushing to GitHub:
git push origin master
We have a help doc that has some instructions for this below:
https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
Let me know if you run into any trouble with that!
The only thing they did not mention was that you will be prompted for a username and password. This is the username and password for Github (not the token created for the repository)
Also in the linked documentation, in the above they use:
git push -u origin master
as the last step, I got an error when I did not include the -u
I also did not need to clone it.
The remote connection in Xamarin now links to this new repository. I have made and committed some changes to check.

How to set a GIT HUB user in .travis.yml?

How to set a GITHub user name in the below Git clone command?. I am new to GIT HUB and planning to keep this command in .travis.yml file.
My .travis.yml file should execute irrespective of the Git Hub user. Could you please help me in setting this up.
git clone https://github.com/**gitgubusername**/repositoryname/
If the repository is public, you don't need to setup a user.
The git clone command itself will be enough.
Travis will infer the url from where the .travis-ci.yml file is.
For private repos accessed by Travis, see "Private Dependencies".

Exporting a local EGit repo to local GitStack repo

I've set up GitStack on my computer in order to be able to make builds of my application on various machines. My Eclipse project has a local git repo but I can't figure out how to connect the two.
The Team > Remote > Push and Team > Push to Upstream are unavailable (grey).
I've configured the following things and read this tutorial:
Git user name and email in Eclipse.
I've added a user and a repo in Gitstack.
I've also tried to click on my local git repo and do Paste Repository Path or URI and I manage to connect to my GitStack repo on localhost though its obviously empty. I suppose this is what I have to do on other machines to sync stuff?
How do I connect the two?
Here are my command line attempts (note: im using cygwin):
[~/eclipse/JfxMCApp]> git.exe remote add jfxmcapp.gitstack.local http://localhost/JfxMCApp.git
[~/eclipse/JfxMCApp]> git.exe remote -v
jfxmcapp.gitstack.local http://localhost/JfxMCApp.git (fetch)
jfxmcapp.gitstack.local http://localhost/JfxMCApp.git (push)
[~/eclipse/JfxMCApp]> git.exe push jfxmcapp.gitstack.local
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
After this Git just hangs for ages?
Update: it appeared in eclipse after adding it git remote add
First: try to use the git command-line client. Git is powerful and evil – and will not tell you any of it’s secrets if you hide it away behind GUIs.
About your question: Now that you set up your gitstack repo as a remote, all you need to do is push. If the push to upstream options are not available, try doing it from the command line: Run the git shell, go to your project dir and run git push.