how to upload (commit) my first project to git hub from xcode - xcode

I started commiting my project to github.
For that I created an account in github with email and password.
Then on the console I did inital stuff:
cd project
git init .
git add .
git commit -s
-> I did not commit (stopped without comment), because I expected to enter a password.
In Xcode I committed one file for testing, but I was supriced why I was not asked for a password.
In the logs I see that it was published with a user, that I don't know : user#users-Mac.local
So I don't know where the file is published now for public !
Then I changed my name and email as follow:
xcrun git config --global user.name 'xxxxx'
xcrun git config --global user.email 'yyyyy'
But still I don't have to provide a password and I guess it is not working properly with my account.
Can anyone help me out ?

Getting code onto GitHub has two main steps:
git commit your changes
git push to GitHub
Nothing's asking you for a password when you commit, because that's still totally local to your machine. Only when you push will you need to authenticate with GitHub.
Check out these guides to help you get started:
Git basics
Set up Git with GitHub

Related

Git - The Remote Repository Rejected Commits

I created a new branch manually from Xcode, which for some reason did not show up on the repository, so I made another branch from the GitHub browser manually. Then when trying to commit I'm met with the error:
"The remote repository rejected commit. Make sure you have permission to push to the remote repository and try again."
I've talked to my boss who ensured that I'm given written permission, so we're both confused as to why I can't commit properly.
If you have this option selected in the Email Settings page of GitHub it will prevent you from pushing.
You need to go in to terminal, and then go to your project directory and type these commands.
xcrun git config user.name "your username here"
xcrun git config user.email youremail#somedomain.com
Make sure the user name and emails are the exact ones that you use on github, gitlab etc.
I was using "Personal Access Token" for authentication and was facing the same issue. For some reason, generating a new token and entering it again in Xcode -> Preferences -> Accounts fixed it.

Xcode Repositry Git Error

Please review the screen shot, and let me know how can i fix this? I am using my computer and this configuration from last 1 year and I have no issue, It is suddenly happen.
You seem to try to commit/push to a remote repository, while you haven't yet given git your identity/email address + password.
The steps to do this are already stated in the error message:
Just open up Terminal and enter the two commands:
git config --global user.email "youremail#example.com"
git config --global user.name "Your Name"
You'll be prompted for your password several times. To cache your password follow the instructions here: https://help.github.com/articles/caching-your-github-password-in-git/

Is it time to get a new Github account?

I got my Github account last year in February and configured it on my Windows XP. Successfully configured user.name and global email account. I switched operating system to Windows 8 and accessed the same Github account online.
I took the Try Git course and other supporting materials to start working with the repositories, but Git Bash keeps coming up with the invalid username and password login error on Bash. Completed the forking and would like to start working on a cloned .git template now, but I can't pass the error message.
I tried changing my username, which solved the error partially. On my local repositories list the newly forked folders are not found, and I'm not seeing any guides on how to use Git Shell on the website.
Any ideas on whether this is just a system setup error or is it time to get a new Github account?
You should check your git config using git config --list. If it differs from what your are using then change it with git config user.name YOUR_USERNAME and git config user.email YOUR_EMAIL. More info here.
What you configure as user.name and user.email is what goes into the author and committer fields of commits you create. It has nothing to do with authentication.

What are the necessary settings for "git configuration"?

when I create a project in Xcode 4.3 it keeps on displaying message saying below.I did not get what that means and how to do the necessary settings.
Any help will be greatly appreciated.
Thanks
Baha
Please tell me who you are
Run
git config --global user.email
"you#example.com"
git.config --global user.name"Your
Name"
to set your account's default identity.
Omit --global to say the identity only in
this repository.
fatal:unable to auto-detect email address
(got 'Home#s-imac-3.(none)")`
It's telling you literally, exactly what to do. Open a Terminal session, and run this, replacing 'you#example.com' with your email address:
git config --global user.email "you#example.com"
This sets your email address for git, it uses this to identify who you are in commits.
Then, run this, replacing 'Your Name' with your name:
git config --global user.name "Your Name"
This sets your name for git commit messages, it uses this to give a more readable name to commits.
If this stuff is not clear to you, you really owe it to yourself to learn git: http://try.github.io
Set Name & Email in Xcode preference, this issue will be resolve
Follow these 4 simple steps
Xcode => Preferences => Source control => Git
Set ( Author Name ) & ( Author Email ), just for identify that the code committed by this name/email
close Xcode and re-open project
now try to commit code, it should be working fine now.
Could be a issue with Xcode. Go to your git directory and set the user locally. See the following help thread at Apple Forum for more info:
https://forums.developer.apple.com/thread/18189
I had same issue in xCode 8.3.2, when I tried to create git repository on local machine. And I fixed it by setting local repository name and email. If anyone is having same issue; just run these commands in terminal:
cd my/project/directory (Navigate to project directory)
git config --local user.email "me#me.com"
git config --local user.name "myname"
NOTE: This is for local repository, and "--global" flah can be used for remote repositories.

Migrating forked project from Heroku to Github

Some time ago I found some code in one Github repo. I downloaded it (did not fork it), started upgrading it and when I was happy with the result, I used Heroku as a host. So now the code lives on my computer and Heroku. How could I push it to my Github account, but also give the original author of the project some credit for it (showing on my Github that I actually forked it)?
Okay, so I actually figured it out already!
First, create a new repository on github, let's name it github-project.
git clone git#heroku.com:<heroku-project>.git
cd <heroku-project>
git remote rm origin
git remote add github https://github.com/<github-username>/<github-project>
git pull github master
Now you'll probably see some conflicts. If you want to preserve all your changes, just add them all.
git add .
git commit -m "some message"
git push github master
This is quite simple:
Create an empty repository on GitHub, let's call it github-project
Clone from Heroku, let's call it heroku-project
Add a remote for github
Push to GitHub
The commands to perform these steps:
git clone git#heroku.com:heroku-project.git
cd heroku-project
git remote add github https://github.com/github-username/github-project
git push -u github master
That's it!
Note: if you already created the GitHub project with a README file in it, then it is NOT empty anymore, and the last push will be refused. In that case you can force the push, effectively overwriting the project on GitHub, by using the --force flag, for example:
git push -u github master --force

Resources