I have a project already connected to visual studio team services, because it is already connected there is no option to connect to a new git repository.
Does anyone know how to send the source code to GitHub through visual studio when this is the case?
When I go to the file menu there is nothing saying "add to source control".
Or in the bottom right button, there is only a master button which has something about branches.
I don't understand why they make it so hard by redefining so many things like download to pull and upload to push.
Can someone tell me that answer as well?
It is easier to switch to command line and check if your local sources are themselves in a Git repo:
cd /path/to/local/project
git status
git remote -v
If those commands fails, that means your project is connected to visual studio team services through TFVC, and not Git, in which case, you need to create a local Git repo (which will co-exists with the TFVC one)
git init .
git add .
git commit -m "first commit"
Eve if the Git repo already existed, you can continue with:
git remote add github /url/empty/GitHub/repo
git push --mirror
Related
When I build a project with Xcode, the default git location is fine. I'm able to initiate source control through Xcode like normal. But when I build sessions from other Apps, such as the Projucer, I can't use the custom git location, as it doesn't see all the files. I need to manually create the first git commit in the correct location with:
git init
git add .
git commit -m "First Commit"
After this, Xcode sees the git repo and as is able to take off from there, and I dont have to use command line after that.
My question is, is there a way to set the default location of git within Xcode? Avoiding commands? Also, are there any visual ways to gitignore files through Xcode? Thank you.
As illustrated in Setting up a git repository in XCode for a pre-existing project, you would still still those Git commands.
The "Git Create Project" of XCode 7 and 8 would still create a .git in the default location (<root of the project>/.git)
My project just on my local no git or anyelse.
So can i use TFS with xcode on Mac OS? If yes, how to setup TFS on Xcode?
Thanks.
Yes, you can share your Xcode projects in TFS using both a Git repository and a TFVC repository.
Share your code in Git using Xcode:
Clone Git repository from TFS
Move your code into the local Git repository.
In Xcode, commit your changes locally.
Push your changes to your team project's repository.
Share your code in TFVC using Xcode:
Download and configure Git-tf
Add Git-tf and the Java runtime to your path.
Go to the root of your local repository.
To share your Git repository in TFS, configure the connection and check in your code.
After you commit changes to your local Git repository, and you're ready to share them in TFS, check them in.
I'm trying to connect to a git repository on visual studio online using git for windows (the one provide by visual studio on team explorer).
I enabled alternate credentials but no matter what I do I got the following message :
fatal: unable to access 'https://xxxxxxxxx.visualstudio.com/DefaultCollection/******/_git/SIT-Prototypes/': Failed connect to xxxxxxxxx.visualstudio.com:443; No error
I tried the following command lines :
git clone https://xxxxxxxxx.visualstudio.com/DefaultCollection/******/_git/SIT-prototypes
git clone https://username:password#xxxxxxxxx.visualstudio.com/DefaultCollection/******/_git/SIT-prototypes
git clone https://xxxxxxxxx.visualstudio.com/DefaultCollection/******/_git/SIT-prototypes -u=username -p=password
Anyone with a miracle solution?
Do you work with a proxy ? If so, you should use the command git config --global http.proxy http://#yourproxy.com:port
I don't see any other mistakes which could lead to these errors if you actually enabled the alternate credentials...
First of all, I am new to Git. Using Git Bash, I created a feature branch 123-Feature-A using git branch 123-Feature-A, checked it out and then added some files through Visual Studio 2010. Git status showed the new files, I added them using git add . - since I have the VS2010 Git Source Control provider installed, I can see the icon changed to indicate that the file has been added.
When I want to switch branches I run something like git commit -a -m "added files" in the feature branch and then switch back to the master branch. When I am in the master branch, I see the files in VS2010, but the icon has a exclamation point and when I try to open it, VS tells me it does not exist - is there a setting in VS to hide files that I added in Brand-A, if I switch to Branch-B
It's been a while, but I think when I had this same issue I installed a git extension to VS.
Try http://www.codeproject.com/Articles/354101/Source-Code-Versioning-with-Git-in-Visual-Studio Or: http://gitscc.codeplex.com/
If you install one of these, make sure to use it consistently to manage git. That will keep VS up to date.
your workflow is totally fine from Git stand point but may be confusing for VS, assuming you have no Git support in it. Eclipse with git plugin detects this scenario just fine and if needed F5 (project refresh) resolves most of issues.
Just double check that you do have git support in your VS, i.e. that you can for example make git commits, switch branches etc. Otherwise, VS will be always confused in such scenarios, because of the way how git operates when branch is changed.
I am trying to figure out how to use git in my project workflow, and I have an existing Xcode project that I want to put into the repository. I think I have the repository set up correctly under organizer, but the Source Control menu is grayed out.
Apparently, it's easy to do if you start a new project, but how do I import an existing project with snapshots and everything?
I'm using Xcode 4 and git 1.7.4
Also, if there are any good walkthroughs on git configuration and best practices, that would be nice. I'm a little late to the game, so anything that can get me up to speed would be cool.
GitHub has some very good git tutorials at help.github.com.
to do the initial setup of a repository, open up a terminal window, and CD to the project directory. once there, type
git init
git add .
git commit -m "Initial commit"
Restart Xcode.
The repository should now be set up, and you will be able to manage it in xcode 4.
Xcode 7 (and 8)
If you were starting a new project you would just check Create Git repository during the setup. (Then skip down to the Commit part below.)
But it you are working with an existing project, go to Xcode > Preferences... > Source Control and check the Enable Source Control box.
Then in the main Source Control menu choose Create Working Copy....
(If you get a "Please tell me who you are" error the see this question/answer or one of the other linked questions there.)
When that has finished, make any change to one of your Xcode project files. Then go back to the Source Control menu and choose Commit.
And write a commit message and click the Commit button. (If the commit button is disabled, then make any minor change to your project and try again.)
In Github sign in and create a new repository.
Call it whatever you want, but don't add a README or .gitignore or license yet. You can add those things later. Doing so now will make the syncing more difficult.
Copy the link to your repository.
Go to Source Control > your branch name > Configure.
Click the Remotes tab > "+" button > Add remote....
Enter the github repository name and paste in the address.
After adding the remote, click Push in the Source Control menu. Enter your github user name and password. That's it. You project should be copied to github now.
(I had some trouble getting my username and password accepted at first. If that happens to you go to Xcode > Preferences... > Accounts > your new repository. Enter your user name and password there and then try the Push again.)
You can add a README and other files, but if you do it from the web, you will have to do Source Control > Pull in Xcode before you con commit other changes.
Now any time you make changes in Xcode, all you have to do is Commit and Push.
I learned this method mostly from here.
See also
The Basics of Git and GitHub
How to add a .gitignore file for Swift in Xcode
I just went through the process of doing this for several projects, and ran into some issues. Here was my process, mostly pieced together from the other answers on this page/site. Order is very important here
Open terminal and cd into the directory containing the .xcodeproj file
git init
In finder enter the newly created .git folder (in the same directory as the .xcodeproj file). Find info/exclude, open and add these lines, .DS_Store and xcuserdata/
Not sure if this is needed, but I used terminal to cp info/exclude over to a .gitignore file
git add .
git commit -m "Initial commit"
Now to get XCode to actually see the repo. In the project organizer, you first have to delete the project from the Projects tab. Then simply re-open the project to get it back. This will detect the GIT repository just created
In the repositories tab of the organizer I then branch off the master branch/switch into whatever version I'm working on.
Hopefully this helps someone without being too redundant. What now seems simple was definitely a challenge for someone new to GIT with existing projects
Check out my post on this topic Setting up a git repository in XCode for a pre-existing project. The above is correct, but it will include UserInterfaceState in your changes as you commit and this could be annoying because this file updates everytime you do anything in xcode, even if it is as simple and navigating through files or folders in your project.
if your XCODE 7 is not connecting with existing GIT repository. Try following
xcrun git config --global user.email your#email.com
xcrun git config --global user.name "your name"
Newer versions of Xcode simplify adding git to an existing Xcode project. Open your project in Xcode and choose Source Code > New Git Repositories. A sheet opens.
Select the checkbox next to the project and click the Create button to add git to the project.
Note:Specially for Xcode 11
CD to project directory using terminal
git init
git add .
git commit -m "Initial commit"
After this restart the Xcode and choose Source Control Navigator and then select the master and right click then choose option "Create Remote"