Cannot add repository account in Xcode - xcode

I don't know why I cannot add a repository account in Xcode.
Product -- Version
Xcode -- 7.3.1
git -- 2.8.1
OSX -- 10.11.5
screenshot from xcode/preferences/accounts

I found the issue. Under preverences / source control, "enable source control" was not checked. Once checked, I was able to add my GitHub remote repository.

You can connect your project to your repository with git bash like this:
$ cd /your/project/path/
$ git init
$ git remote add origin git#github.com:ali/first_app.git # Or other repo URLs
$ git push -u origin --all # pushes up the repo and it's refs for the first time
$ git push origin --tags # pushes up any tags
Hope be useful.

Related

git/visual studio

How do I create a new GitHub repository from a local branch from a cloned repo with visual studio?
Been searching and trying for 3 days but nothing works plz help
you can reveal the files in file explorer from that repository and after that takes the file without git and implement a new git repository
In terminal
$ cd PARENT-FOLDER
$ git init REPOSITORY-NAME
Initialized empty Git repository in /Users/local/repo/.git/
Creates a new folder on your computer, initialized as a Git repository
$ cd REPOSITORY-NAME
Changes the working directory
$ mkdir docs
Creates a new folder called docs
$ cd docs
$ git checkout --orphan newbranch
Creates a new branch, with no history or contents, called newbranch , and switches to the newbranch branch
$ git rm -rf .
Removes the contents from your default branch from the working directory
git add .
git commit -m ‘’
$ git remote add origin https://github.com/USERNAME/REPOSITORY.git
$ git push -u origin BRANCH
commits & pushes changes to repo

git commands working on windows command line but not in Git Bash terminal

I'm working on remote repository with git commands on windows cmd and it works well, but when working with git commands in git bash terminal I get error:
Your configuration specifies to merge with the ref 'refs/heads/feature/branch-name'
from the remote, but no such ref was fetched.
How can I fix it for git bash terminal?
Check first, in your git bash session, the ouput of:
git branch -avv
git status
Make sure the name of the branch you are in matches the remote one, especially considering the case (uper/lowercase), in case it is insensitive in a CMD session, and sensitive in a bash session.
See this example.
If the list of branches show the local one is not linked to a remote tracking one, then, as I documented in "[Difference between git checkout --track origin/branch and git checkout -b branch origin/branch][2]":
git branch -u origin/branch branch
It started working when I moved to the main branch (next).
But, when i switch back to my branch this is what I get:
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> feature/branch-name
Finally found the answer here:
Why do I have to "git push --set-upstream origin <branch>"?
git push -u origin <your-local-branch-name>
So if your local branch name is coffee
git push -u origin coffee

ReadMe file won't allow me to commit and push xcode changes to github

I have an existing xcode project and repo on Github. I recently added a ReadMe file which was suggested by Github but now I can no longer commit and push changes to Github. I keep getting an out of date message. How do I fix this problem?
I had the same experience of adding README.md with the same error.
If you don't want to git pull, because the remote version in Github is outdated.
You can also force push all local branches using:
$ git push -f origin master
The following commands in the Terminal will push your local Xcode project to remote Github.
cd <drag location folder of project>
git init
git push -f origin master
You need to git pull.
If you're using the command line, navigate to the directory of the repository and run git pull. If you're using another interface, the steps may be a bit different.

Xcode upgrade gives "warning: push.default is unset" when doing a git push

I have been using git for some time and it was working fine on my repository. However, I upgraded to XCode 7 recently and now when I try to do a git push <branch>, I get the following error message:
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
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)
fatal: 'Develop_New_Car' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have git version 2.3.3
and running which git gave me /usr/local/bin/git
A git config --global push.default simple should be enough, but XCode7 might not be looking for the global setting in the same place ($HOME) as before.
In that case, try at least to set that config locally in the repo managed by XCode7:
cd /path/to/my/git/repo
git config push.default simple

Xcode Source Control Git

When you create a new xcode project, there is a checkbox, which you can check if you want to use a git repository on your mac. I did not check that box, so right now I don't have access to source control resources. How can I start using git with my project?
I think you would just need to setup a local git repository.
Open terminal on your Mac and type the following commands:
cd <DirectoryYourCodeIsIn>
git init
git add .
git commit -m 'initial commit'
Also, restart XCode after this is completed.

Resources